[oXygen-user] Recusrive COUNT of specific elements in XSL 2.0

G. Ken Holman gkholman at CraneSoftwrights.com
Wed Apr 18 12:27:10 CDT 2012


At 2012-04-18 18:16 +0100, McGibbney, Lewis John wrote:
>Hi Ken,
>------------------------------------------------------
>Can you try something along the lines of:
>
>    <TotalImages value="{count(//img)}"/>
>
>I don't know if you are using namespaces in your source or not, so
>the above might have to change.
>------------------------------------------------------
>
><TotalImages value="{count(//img)}"/>
>   <xsl:value-of select="count(//html:img)"/>
><TotalImages/>
>
>Worked a treat so thank you.

Then you would need value="{count(//html:img)}" to get the namespace 
correct for the attribute.

>I have a problem with the <TotalImages value="function">, however 
>this is not crucial. I get the exact string entered in the brackets 
>back e.g. "{count(//img)}"

Ah ... that tells me our XSLT processor is not conformant in that it 
is not recognizing an attribute value template in a literal result 
element's attribute.  This surprises me as most XSLT processors are 
very conformant in this regard.  Please check your work.

. . . . . . . . . Ken


--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- May 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/x/
G. Ken Holman                   mailto:gkholman at CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal



More information about the oXygen-user mailing list