count with xpath
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 1
- Joined: Thu Mar 02, 2006 5:42 pm
count with xpath
Hi, I have a problem with counting some Xml Elements.
I have an element in the xml structure, which occurs at different positions and different levels. How can I count this element without always starting at a new number, when it occurs in a different Tag
My structure is something like this:
<a>
<b>
<tocount/>
</b>
<b>
<b>
<tocount/>
</b>
<c>
<tocount/>
<c>
</b>
</a>
In my Xslt stylesheet I want get the number of the element, when I match it:
<xsl:template match="tocount">
<xsl:number count='//tocount'/>
</xsl:template>
The result for each element should be an increasing number
<a><b>
1
</b>
<b>
<b>
2
</b>
<c>
3
<c>
</b>
</a>
Thanks for help,
Kirstin
I have an element in the xml structure, which occurs at different positions and different levels. How can I count this element without always starting at a new number, when it occurs in a different Tag
My structure is something like this:
<a>
<b>
<tocount/>
</b>
<b>
<b>
<tocount/>
</b>
<c>
<tocount/>
<c>
</b>
</a>
In my Xslt stylesheet I want get the number of the element, when I match it:
<xsl:template match="tocount">
<xsl:number count='//tocount'/>
</xsl:template>
The result for each element should be an increasing number
<a><b>
1
</b>
<b>
<b>
2
</b>
<c>
3
<c>
</b>
</a>
Thanks for help,
Kirstin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service