Altova Mailing List Archives
>comp.text.xml Archive Home
>Recent entries
>Thread Prev - Re: Hopefully simple XPath question
>Thread Next - Re: Hopefully simple XPath question
Re: Hopefully simple XPath question
To: NULL
Date: 11/13/2004 1:34:00 AM
"Joris Gillis" <roac@p...> wrote in message news:<opshc973seyf9v9r@n...>... > >> In Xpath, it would be: count(preceding::section) > > > > That doesn't quite do it. I ended up with this > > > > <xsl:value-of select="1+count(ancestor::SECTION/preceding-sibling::SECTION)"/> > > That's strange, I would have sworn that "count(ancestor::SECTION/preceding-sibling::SECTION)" gave the same result as "count(preceding::section)" in your xml (or what I understood of it). It went wrong in the second CHAPTER. Given document structure below, 1+count(preceding::SECTION) gave CHAPTER SECTION Items numbered 1.1.x SECTION Items numbered 1.2.x SECTION Items numbered 1.3.x CHAPTER SECTION Items numbered 2.4.x Where I wanted CHAPTER SECTION Items numbered 1.1.x SECTION Items numbered 1.2.x SECTION Items numbered 1.3.x CHAPTER SECTION Items numbered 2.1.x > The '+1' change is logic off course. Just making it 1 based rather then 0 based
Disclaimer
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

