I have an XML format that we use to define our standard that is processed
with XSLT to generate a DTD or Schema based upon that format. Everything
has been ok until we added the target namespace to the schema. I can
parameterize the target attributes value, but I haven't found a way to
general the corresponding xmlns attribute to go with it without hardcoding
the value. Does anyone have a workaround?
Here is the relavent postion of the stylesheet:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd = "http://www.w3.org/2001/XMLSchema"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:saxon="http://icl.com/saxon"
extension-element-prefixes="saxon"
xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
>
<xsl:param name="target"
select="'http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/'"/>
<xsl:template match="/">
<!-- START Schema Output -->
<xsd:schema>
<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>
</xsl:template>
</xsl:stylesheet>
This produces the following Schema:
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.ACORD.org/standards/PC_Surety/ACORD1.1.1/xml/"
elementFormDefault="unqualified" attributeFormDefault="unqualified"
targetNamespace="http://www.ACORD.org/standards/PC_Surety/ACORD1.2.0/xml/"
version="1.2.0"
>
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.
..dan
---------------------------------------------------------------------------
Danny Vint
http://www.dvint.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list