[xquery-talk] XPath/XQuery equivalent of xsl:number?
joewiz at gmail.com
Thu Nov 17 11:04:22 PST 2011
I am constructing a table of contents based on a TEI document (whose
structure consists primarily of nested divs), and would like to be
able to generate appropriate heading levels for each the table of
contents hierarchy. Specifically, I want to be able to generate the
"I", "II", "A", "B", and "a" bits in:
I. Chapter 1
II. Chapter 2
A. Section 1
B. Section 2
a) Subsection 1
Put another way, borrowing from CSS terminology, I need to be able to
format an integer as "upper-roman", "upper-alpha", and "lower-alpha."
Borrowing from XSL terminology, I need to perform the equivalent
function of <xsl:number>, as in:
<xsl:number value="2" format="I'/> ==> returns "II"
<xsl:number value="2" format="a'/> ==> returns "b"
<xsl:number value="2" format="A'/> ==> returns "B"
I think what I really need is XPath 3.0's fn:format-integer()
function, but it appears that XPath 3.0 is still at the Working
So my question: Of course I could hack my own format-integer()
function together (indeed, my current kludge is to pipe out my
integers to an XSL stylesheet), but is there an XPath or XQuery
library that would let me do this?
More information about the talk