[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 ?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|