Subject: Re: [xsl] Grouping with keys From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 07 Feb 2006 10:12:24 -0500 |
Hi prakash,
thanks for helping, this is a good idea, but in my "big" xslt, i have a construction, where i need a solution with a key.
have you/someone an idea, what4s wrong in my key version? > > <xsl:key name="heading" match="wordDorcument/body/sect/p" > use="generate-id((preceding-sibling::p[pPr/pStyle/@val='Heading1'" /> > <xsl:key name="prog" match="pPr/pStyle/@val='Programlisting'" > use="generate-id((preceding-sibling::p[pPr/pStyle/@val='Programlisting'" > />
* The XPath on the @use attribute isn't syntactically correct, which one can see readily due to the lack of closing brackets or parentheses. This should give you an error. * You'll probably also want to find the *first* or immediately preceding p sibling with the selection criterion, as in
-- which you'll need since otherwise you'll get the generated id of the first such p on the axis in document order, which isn't what you want for this grouping idiom.
But it may be worth trying Prakash's solution if it's simpler (hence easier to construct, code and maintain). People often assume they have to optimize for performance before they actually do.
I recently saw a fabulous old advertisement for a machine tooling manufacturer: "If you know you need new tools and you haven't yet acquired them, you're already paying for them". This applies to programming too. But the converse is also true: if you don't know you need new tools but have already acquired them, you may be paying extra.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping with keys, Silvia Liberto | Thread | Re: [xsl] Grouping with keys, Silvia Liberto |
RE: [xsl] namespaces problem - two , Andrew Ballantine | Date | Re: [xsl] Registering a Custom ttf, Wendell Piez |
Month |