Subject: [xsl] 'copying' the default namespace From: Carl Yu <carl.yu@xxxxxxxxxxxx> Date: Thu, 16 Jan 2003 14:37:43 -0800 (PST) |
I know this has been covered before... and I know that XSLT 2.0 will probably have the robust answer, but this XSL generates some interesting behavior. I wonder if any of the XSL gurus can figure out why Xalan would generate this type of output. And, if there's any way around it. in.xml -- <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <root version="0.1" xmlns="http://www.teradyne.com/test"> <child/> </root> test.xsl -- <?xml version="1.0"?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ter="http://www.teradyne.com/test" version="1.0"> <xsl:output method="xml" indent="yes"/> <!-- IDENTITY copy, exclude failed patterns --> <xsl:template match="ter:*|@*"> <xsl:copy> <xsl:apply-templates select="ter:*|@*" /> </xsl:copy> </xsl:template> <xsl:template match="ter:root/ter:child"> <xsl:element name="newChild" /> </xsl:template> </xsl:transform> out.xml -- <?xml version="1.0" encoding="UTF-8"?> <root xmlns="http://www.teradyne.com/test" version="0.1"> <newChild xmlns:ter="http://www.teradyne.com/test" xmlns=""/> </root> So here's the question. First, what's the deal with the xmlns:"{uri}" and xmlns=""? Second, is there a way to prevent newChild from carrying any kind of namespace declaration. Finally, in my XSLT doc I want to only match against <root xmlns="http://www.teradyne.com/test"> <child/> </root> my match statement was the utterly redundant "ter:root/ter:child"... there's gotta be a better match statement (like "ter:root/child"... which doesn't work.) -Carl XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] indenting identity, J.Pietschmann | Thread | Re: [xsl] 'copying' the default nam, Mike Brown |
[xsl] indenting identity, Carl Yu | Date | Re: [xsl] reposting.append to a fil, J.Pietschmann |
Month |