Subject: Re: [xsl] Avoiding namespace generation in elements From: Michael Kay <mike@xxxxxxxxxxxx> Date: Fri, 03 Jun 2011 08:00:45 +0100 |
Good day,
I am transforming a XML file to XSD using Saxon and XSLT 2.0
I am manually creating the 'schema' element, since I am adding namespaces to it. This causes Saxon in add xmlns:xs="http://www.w3.org/2001/XMLSchema" to each of the child elements. Using exclude-default-prefixes="xs" has no effect.
Sample output: <xs:schema targetNamespace="http://my.happydomain123.com/test/testing/1.0" xmlns:tt="http://my.happydonain123.com/test/testtypes/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:simpleType xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Testing1"> <xs:restriction base="xs:integer"/> </xs:simpleType> <xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="TestAgent2" type="tt:TestAgent"/> </xs:shcema>
Crappy way of creating main schema that is causing the headache: <xsl:value-of disable-output-escaping="yes">
Michael Kay Saxonica
<</xsl:value-of>xs:schema targetNamespace="<xsl:value-of select="$ns-map/namespaces/namespace[@pim-ns=$target-namespace and @version=$target-namespace-version]/@namespace-uri"></xsl:value-of>" xmlns:xs="http://www.w3.org/2001/XMLSchema" <xsl:for-each select="$distinct-namespaces"> <xsl:variable name="pim-ns" select="./text()" as="text()"></xsl:variable>xmlns:<xsl:value-of select="$ns-map/namespaces/namespace[@pim-ns=$pim-ns and @version=max($ns-map/namespaces/namespace[@pim-ns=$pim-ns]/@version)]/@prefix"></xsl:value-of>="<xsl:value-of select="$ns-map/namespaces/namespace[@pim-ns=$pim-ns and @version=max($ns-map/namespaces/namespace[@pim-ns=$pim-ns]/@version)]/@namespace-uri"></xsl:value-of>" </xsl:for-each> elementFormDefault="qualified"<xsl:value-of disable-output-escaping="yes">></xsl:value-of>
As you can see, I am creating namespace attributes on the fly, which is why I can't just add<xs:schama> as part of my xslt.
Kind regards, Jacobus
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Avoiding namespace genera, Jacobus Reyneke | Thread | [xsl] replace(), translate() and Un, Kenneth Reid Beesley |
[xsl] replace() and translate() sec, Kenneth Reid Beesley | Date | Re: [xsl] replace() and translate(), Michael Kay |
Month |