[xsl] How to get page range within a group

Subject: [xsl] How to get page range within a group
From: "J. S. Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Fri, 12 Sep 2008 11:08:34 +0530
Hi All,
I am not able to get the appropriate result. Can anybody let me know about the mistake I am doing. I want a page range within <doc>.

<!-- INPUT -->
<pb n="FFCP-i"/>
<p><pb n="FFCP-ii"/></p>
<doc id="a1">
<pb n="FFCP-1"/>
<p><pb n="FFCP-2"/></p>
<p><b><pb n="FFCP-3"/></b></p>

<doc id="a2">
<pb n="FFCP-4"/>
<p><pb n="FFCP-5"/></p>
<p><b><pb n="FFCP-6"/></b></p>

<!--XSLT -->
<xsl:template match="docGroup/doc">
	<xsl:call-template name="citationPageRange"/>

<xsl:template name="citationPageRange">
<xsl:if test="ancestor::docGroup">
<xsl:if test="//doc//pb[position()=1]">
<xsl:variable name="fpage" select="substring-after(//doc//pb[position()=1]/@n,'-')"/>
<xsl:text>pp. </xsl:text>
<xsl:value-of select="$fpage"/>
<xsl:if test="//doc//pb[position()=last()]">
<xsl:variable name="lpage" select="substring-after(//doc//pb[position()=last()]/@n,'-')"/>
<xsl:value-of select="$lpage"/>

<!-- OUTPUT -->
pp. 1--3

Thanks in advance!!!

Current Thread