|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: XPath Question
>Given the following xml, > ><p style="Normal" tabs="0.2 1.2 2.2"> > Once upon a time, there was a <b>dark</b> and <i>stormy</i> sea. >Nobody could be<br/> > certain what lay beneath it's churning surface.<br/> > <tab/>One<tab/>Green<tab/>Octopus<br/> > <tab/>Two<tab/>Red<tab/>Sharks<br/> > Or something far more sinister? ></p> > >how do I say, from inside a br-match template: > >"The number of br nodes, of the parent axis's p node, that have >immediately preceding siblings that are tab nodes" > >I tried this, (and many other things besides) but it didn't work... > ><xsl:variable name="rows" >select="count(parent::p/br::preceding-sibling::tab[1])"/> This is not a valid Xpath statement. You need to use a predicate: count(parent::p/br[preceding-sibling::tab[1]]) This will return the number "2" given your source XML. HTH, RG 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
|

Cart








