xsl-list
[Top] [All Lists]

Re: [xsl] Transformation Grouping Problem (XSLT 2.0, Saxon-PE 9.3.0.5)

2011-09-16 09:53:14
Raymond Lillibridge wrote:

For instance, I'd like to create an XML result-document that contains only:

<book>
             <title>My Book Title</title>

             <para>book Blah, blah, blah</para>
             <para>book Dah, dah, dah</para>
             <para>book Lah, lah, lah</para>  </book>


...and another XML result-document that contains only:

<level1>
             <title>level1 AAA</title>
             <para>level1 Blah, blah, blah</para>
             <para>level1 Dah, dah, dah</para>
             <para>level1 Lah, lah, lah</para>  </level1>

...&c.

  <xsl:template match="book | level1 | level2 | level3">
    <xsl:copy>
      <xsl:copy-of select="*[not(*)]"/>
    </xsl:copy>
  </xsl:template>

then add

  <xsl:template match="/">
    <xsl:apply-templates select="//book"/>
  </xsl:template>

or e.g.
  <xsl:template match="/">
    <xsl:apply-templates select="//level1"/>
  </xsl:template>

as needed depending on which kind of elements you want to output.


--

        Martin Honnen --- MVP Data Platform Development
        http://msmvps.com/blogs/martin_honnen/

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