xsl-list
[Top] [All Lists]

RE: [xsl] copying namespaces question

2012-07-03 03:46:57
For the ones interested ... I wrote an article explaining 2 approaches used to 
solve the problem:

http://robbypelssers.blogspot.nl/2012/07/splitting-xml-content-into-multiple.html

Thx for the help !!
Robby

-----Original Message-----
From: Robby Pelssers [mailto:Robby(_dot_)Pelssers(_at_)nxp(_dot_)com] 
Sent: Monday, July 02, 2012 12:53 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] copying namespaces question

It seems like great minds think alike !! ;-)

Thx a lot (again)... !!!!

Robby

-----Original Message-----
From: Andrew Welch [mailto:andrew(_dot_)j(_dot_)welch(_at_)gmail(_dot_)com] 
Sent: Monday, July 02, 2012 12:50 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] copying namespaces question

On 2 July 2012 11:40, Michael Kay <mike(_at_)saxonica(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--