A revised stylesheet with one entry
being for the default namespace (no prefix) would be useful.
Note that attributes have a different meaning for no-prefix than
elements, so to include that case you have to use element nodes rather
than attribute nodes to generate the namespaces, but basically it's as
before
<namespaces>
<namespace prefix="xsd">schema ns</namespace>
<namespace prefix="">defaulttns</namespace>
<namespace prefix="yy">ACORD default URL</namespace>
<namespace prefix="acord-doc">ACORD doc URL</namespace>
<namespace prefix="jag">ACORD JAG URL</namespace>
</namespaces>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:saxon="http://icl.com/saxon"
exclude-result-prefixes="saxon"
xmlns:xsd="schema ns"
>
<xsl:output method="xml" indent="yes" />
<xsl:template match="/">
<xsd:schema>
<xsl:variable name="rtf">
<xsl:for-each select="/namespaces/namespace">
<xsl:variable name="x"><xsl:if
test="string(@prefix)">:</xsl:if></xsl:variable>
<xsl:element name="{(_at_)prefix}{$x}foo" namespace="{.}"/>
</xsl:for-each>
</xsl:variable>
<xsl:copy-of select="saxon:node-set($rtf)/*/namespace::*"/>
</xsd:schema>
</xsl:template>
</xsl:stylesheet>
$ saxon ns2.xml ns2.xsl
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema
xmlns:xsd="schema ns"
xmlns="defaulttns"
xmlns:yy="ACORD default URL"
xmlns:acord-doc="ACORD doc URL"
xmlns:jag="ACORD JAG URL"/>
________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--