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

Re: Generating schema target namespaces from XSLT

Subject: Re: Generating schema target namespaces from XSLT
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Sat, 02 Nov 2002 20:13:13 +0000
xsl stylesheet targetnamespace
Hi Danny,

>I can get the targetNamespace attribute set, but becasue the namespace has 
>to be identified on the <stylesheet> attribute I can't use a parameter 
>there to set this value to be the same - thus I have to hard code it.
>
I assume you are declaring the namespace on xsl:stylesheet so that it
gets declared on the generated xsd:schema?

If so, then the trick is to create a temporary node with the required
namespace derived from $target, and then copy the namespace node to
the output xsd:schema element.  This requires an extension function,
but I see you are already declaring the saxon namespace.

  <xsl:variable name="ns-node">
      <xsl:element name="ns-element" namespace="{$target}"/>
  </xsl:variable>

  <xsd:schema>
       <xsl:copy-of
select="saxon:node-set($ns-node)/ns-element/namespace::*[local-name()='']"/>
       <xsl:attribute
name="elementFormDefault">unqualified</xsl:attribute>
       <xsl:attribute
name="attributeFormDefault">unqualified</xsl:attribute>
       <xsl:attribute name="targetNamespace"><xsl:value-of 
select="$target"/></xsl:attribute>
       <xsl:attribute name="version"><xsl:value-of 
select="ACORD-XML-DOC/@version"/></xsl:attribute>

  </xsd:schema>

Does that do what you want?

Alternatively, you could set the value of the targetNamespace
attribute from the xsl:stylesheet declaration by an expression like
   document('')/xsl:stylesheet/namespace::*[local-name()='']
i.e. doing away with the parameter.

Best regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.