|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] default namespace and the namespace attribute
Joshua, Gareth, thanks for your help!
I've looked at the relevant section of Mike Kay's (excellent) book (page 211
in the second edition), and I haven't been able to solve my main problem.
My stylesheet does not bind the default namespace to a uri, but the element
created by the
<xsl:element name="content">
....
</xsl:element>
ends up (in the result document) in the namespace bound to "uri:foo".
Adding the attribute namespace="uri:bar" to <xsl:element> causes the
<content> element in the result document to be in the "uri:bar" namespace,
but if I use namespace="", I get exactly the same result document as if I
exclude the namespace attribute.
I'm afraid I'm missing something simple here -- can someone help?
Once again, I'm using Xalan 1.2.
Thanks,
David
---------------------Source:
<?xml version="1.0"?>
<top xmlns="uri:foo">
<next name="bar"/>
<next name="baz"/>
</top>
---------------------Transform:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:po="uri:foo"
version="1.0">
<xsl:template match="po:next">
<xsl:copy>
<xsl:value-of select="@name"/>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="po:top">
<xsl:copy>
<xsl:element name="content">
<xsl:apply-templates select="*"/>
</xsl:element>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--------------------Result:
<?xml version="1.0" encoding="UTF-8"?>
<top xmlns="uri:foo">
<content xmlns:po="uri:foo">
<next>bar</next>
<next>baz</next>
</content>
</top>
"Live as if you will die tomorrow - study as if you will live forever."
-- Erasmus
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








