Subject: Re: [xsl] Generating schema target namespaces from XSLT From: Dan Vint <dvint@xxxxxxxxxxxxxx> Date: Fri, 08 Nov 2002 19:36:50 -0800 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Generating schema target , Trevor Nash | Thread | Re: [xsl] Generating schema target , Trevor Nash |
Re: [xsl] xslt replace special char, Mike Brown | Date | RE: [xsl] checking for empty elemen, James Carlyle |
Month |