xsl-list
[Top] [All Lists]

Re: [xsl] Copying parent nodes with different selection of their content

2007-04-25 08:09:38

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="2.0">
   
    <xsl:output indent="yes" />
   
    <xsl:variable name="copy-me">
        <Header>
            <Meta />
        </Header>
        <Body>
            <Document>
                <Preceding-1 />
                <Preceding-2 />
                <Make-Toute-Seul-1 />
                <Make-Toute-Seul-2 />
                <Make-Toute-Seul-3 />
                <Following-1 />
                <Following-2 />
            </Document>
        </Body>
    </xsl:variable>
   
   
    <xsl:template match="/">
      <xsl:apply-templates select="$copy-me/*"/>
    </xsl:template>
    
    <xsl:template match="Body">
      <xsl:variable name="x" 
select="Document/*[starts-with(name(),'Make-Toute-Seul-')]"/>
      <xsl:copy>
        <xsl:for-each select="$x">
          <Document>
            <xsl:copy-of select="(../* except $x)|."/>
          </Document>
        </xsl:for-each>
      </xsl:copy>
    </xsl:template>
</xsl:stylesheet>

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