Subject: [xsl] default namespace and the namespace attribute From: "Huebel, David" <dhuebel@xxxxxxxxxxxxxx> Date: Fri, 25 May 2001 08:30:02 -0500 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Complicated count() query - t, Zak McGregor | Thread | [xsl] XSLT and #temptable, pcaspian |
Re: [xsl] Problem with key(), Jeni Tennison | Date | Re: [xsl] Problem with attributes, Jeni Tennison |
Month |