Joe, In eXist-db (which I happen to know you are using), if you want the format-number function, you can just call - xsl:format-number(...) from XQuery, see the signature for in the eXist-db function guide - xsl:format-number($number as numeric?, $format as xs:string) xs:string
However I doubt format-number function is actually what you want as it doesnt appear to support roman numerals. As such I think Ken's example is a good start On 17 November 2011 19:04, Joe Wicentowski <[email protected]> wrote: > Hi all, > > 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[1], but it appears that XPath 3.0 is still at the Working > Draft stage. > > 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? > > Thanks, > Joe > > [1] http://www.w3.org/TR/xpath-functions-30/#func-format-integer > _______________________________________________ > [email protected] > http://x-query.com/mailman/listinfo/talk > -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk _______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
