[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: display parts of XML tree with xsl:copy ?

Subject: Re: display parts of XML tree with xsl:copy ?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Feb 2002 15:43:36 +0000
parts of a tree
Hi Robert,

> How can I controll that only those ancestors are copied that are in
> an valid articles supertree?

Using the push method (the identity template plus other templates to
steer the processing), you need to add a template that matches the
document element of your stylesheet (which I'll assume is called
'issues'), and tells the processor to only process those issue
elements that contain an article with an author named 'Karen Botnich':

<xsl:template match="issues">
  <issues>
    <xsl:apply-templates select="issue[articles/article/authors/author =
                                       'Karen Botnich']" />
  </issues>
</xsl:template>

Using the pull method (the single template with the xsl:for-each) you
do roughly the same thing - just select those issues for processing:

<xsl:template match="/">
  <issues>
    <xsl:for-each
      select="/issues/issue[articles/article/authors/author =
                            'Karen Botnich']">
      <issue>
        <xsl:copy-of select="volume | number" />
        <articles>
          <xsl:copy-of
            select="articles/article[authors/author = 'Karen Botnich']" />
        </articles>
      </issue>
    </xsl:for-each>
  </issues>
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.