[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Trying to build a schema and add a namespace

Subject: Re: Trying to build a schema and add a namespace
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 20 Apr 2005 11:25:00 +0100
xsd prefix
  Maybe you'd be kind enough  to explain why you think the declarations are
  not needed.

Sorry I didn't look that carefully at your code, I just assumed that it
was following the outline I'd sketched, but in your case they were
needed as you were not generating the namespace using the namespace
attribute on xsl:attribute, not were you selecting the namespace nodes
with the namespaqce axis.

Here's a corrected version

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
             xmlns:xsd="schema ns"
<xsl:output method="xml" indent="yes" />

<xsl:template match="/">


<xsl:variable name="rtf">
<xsl:for-each select="/namespaces/namespace">
      <xsl:attribute name="{@prefix}:foo" namespace="{.}"/>
<xsl:copy-of select="saxon:node-set($rtf)/*/namespace::*"/>


running on

<namespace prefix="xsd">schema ns</namespace>
<namespace prefix="yy">ACORD default URL</namespace>
<namespace prefix="acord-doc">ACORD doc URL</namespace>
<namespace prefix="jag">ACORD JAG URL</namespace>


$ saxon ns2.xml ns2.xsl
<?xml version="1.0" encoding="utf-8"?>
  xmlns:xsd="schema ns"
  xmlns:yy="ACORD default URL"
  xmlns:acord-doc="ACORD doc URL"
  xmlns:jag="ACORD JAG URL"/>

Note that compared to the input doc that you posted I edited the entry
for "xsd" so that the URI matched the uri given in the stylesheet
otherwise you get an error with a clash for the xsd prefix and similarly
I removed the xml entry as its "pseudo value" clashed with the real uri
of the implictly declared xml prefix, and since it's implictly declared
anyway you don't need it (and can't generate a namespace declaration for


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.