Subject: Re: [xsl] copying namespaces question From: Wolfgang Laun <wolfgang.laun@xxxxxxxxx> Date: Tue, 3 Jul 2012 10:57:13 +0200 |
On 03/07/2012, Robby Pelssers <Robby.Pelssers@xxxxxxx> wrote: > For the ones interested ... I wrote an article explaining 2 approaches used > to solve the problem: This is the solution I had in mind when I wrote that copying (rather than constructing) the element might avoid hard-coding the namespace. It's not as elegant as the other solution but I hope that it isn't marred by serious flaws. If so, I'd like to learn! -W <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mycompany="www.mycompany.com"> <xsl:template match="/mycompany:objects"> <xsl:apply-templates select="./*"> <xsl:with-param name="root" select="."/> </xsl:apply-templates> </xsl:template> <xsl:template match="mycompany:object"> <xsl:param name="root"/> <xsl:variable name="elem" select="."/> <xsl:for-each select="$root"> <xsl:result-document href="{concat('file:///home/wlaun/XSLT/', $elem/mycompany:name, '.xml')}" method="xml"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:copy-of select="$elem"/> </xsl:copy> </xsl:result-document> </xsl:for-each> </xsl:template> <xsl:template match="@*"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] copying namespaces questi, Robby Pelssers | Thread | [xsl] XSLT FAQ?, Martin Honnen |
RE: [xsl] copying namespaces questi, Robby Pelssers | Date | [xsl] XSLT FAQ?, Martin Honnen |
Month |