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

Re: Selecting nodes based on previous node values

Subject: Re: Selecting nodes based on previous node values
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 11 Dec 2008 09:33:16 GMT
Re:  Selecting nodes based on previous node values
> I want to print all book titles in library with criteria status = "active".

 <xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:reporting="http://www.sophis.net/reporting">

<xsl:template match="demo">
  <xsl:apply-templates
  select="library[criteria/status/@value='active']/books/book"/>
</xsl:template>

<xsl:template match="book">
: <xsl:value-of select="@title"/>
</xsl:template>

 </xsl:stylesheet>

> What did I wrong?


preceding::/

that would be asking for the preceding / node, which isn't what you
meant' you meant


/books[preceding::status

but ther eis no need to keep goiing back looking everywhere in all
earlier nodes, also you would need a [1] otherwise if any earlier status
was active you would list the book, but you want to just check the
immediately preceding element.


 select="./@title"

./ at the front of a select never does anything (it doesn't do any harm)



similarly

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

is the default template so doesn't actually make any difference here.


David


________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

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.