[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Apply
RE: [xsl] Apply across a collection?
Subject: RE: [xsl] Apply <xsl:number level="any"/> across a collection? From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 8 Oct 2007 23:00:40 +0100 |
> Output is all as desired except that the numbering is reset > to 1 at each document node. Is it a built-in limitation of > xsl:number that operates within single document nodes only, Yes, xsl:number produces a result that is a function of a node's position within its containing document. > or am I missing some way to accomplish what I want other than > putting the whole collection into a variable like so: > > <xsl:variable name="wrapper"> > <wrapper> > <xsl:sequence select="collection('docs.xml')"/> > </wrapper> > </xsl:variable> > > and then applying templates to $wrapper? (This works fine, > I'm just wondering if it's the optimal solution.) That's clearly potentially very inefficient, but if you really need a number with those characteristics, that's the easiest way of getting it. If you're prepared to do some coding, a more efficient approach might be to build some kind of index document that counts the nodes in each document in the collection, and then do computations based on the start position of each document. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Add numbers, Mukul Gandhi | Thread | [xsl] Whitespace around comments, Anderson, Paul |
RE: [xsl] XML/XSLT for web templati, Michael Kay | Date | Re: [xsl] XML/XSLT for web templati, Kamal Bhatt |
Month |