xsl-list
[Top] [All Lists]

[xsl] How to get page range within a group

2008-09-12 01:47:04
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 -->
<main>
<div>
<pb n="FFCP-i"/>
<p><pb n="FFCP-ii"/></p>
</div>
<docGroup>
<doc id="a1">
<pb n="FFCP-1"/>
<div>
<p><pb n="FFCP-2"/></p>
<p><b><pb n="FFCP-3"/></b></p>
</div>
</doc>

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

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

<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>
<xsl:if test="//doc//pb[position()=last()]">
<xsl:variable name="lpage" select="substring-after(//doc//pb[position()=last()]/@n,'-')"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="$lpage"/>
<xsl:text>.</xsl:text>
</xsl:if>
</xsl:if>
</xsl:template>

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

Thanks in advance!!!


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>