Subject: Re: copying namespaces question
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 2 Jul 2012 11:49:30 +0100
|
On 2 July 2012 11:40, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I think I would do it like this:
bah, as I was typing it out....
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* ,node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<xsl:for-each select="//*:object">
<xsl:result-document href="path/to/{*:name}.xml">
<xsl:apply-templates select="root(.)/*">
<xsl:with-param name="current-object" select="."
tunnel="yes"/>
</xsl:apply-templates>
</xsl:result-document>
</xsl:for-each>
</xsl:template>
<xsl:template match="*:object">
<xsl:param name="current-object" tunnel="yes"/>
<xsl:if test=". is $current-object">
<xsl:copy>
<xsl:apply-templates select="@*, node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--
Andrew Welch
http://andrewjwelch.com
| Current Thread |
Michael Kay - 2 Jul 2012 10:41:11 -0000
- Robby Pelssers - 2 Jul 2012 10:48:42 -0000
- Andrew Welch - 2 Jul 2012 10:49:38 -0000 <=
|
|