xsl-list
[Top] [All Lists]

Re: [xsl] Iterating recursivly on a node changing the element names

2007-11-21 07:33:35
At 2007-11-21 10:18 +0000, Andrew Welch wrote:
On 21/11/2007, ML mail <mlnospam(_at_)yahoo(_dot_)com> wrote:
Use the standard identity template with a specific template to put
<start> and all of it's descendants into the namespace:

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="*[ancestor-or-self::start]">

Don't forget that ancestry can also be expressed more succinctly as follows:

  <xsl:template match="start | start//*">

. . . . . . . . . Ken

        <xsl:element name="nsprefix:{local-name()}">
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

...make sure "nsprefix" is mapped somewhere.


--
Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
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>
--~--