Dear All,
I am having a tricky XML which i have to view in IE using XSL. (As IE
does not support XSLT 2.0), the solution should be in XSLT 1.0
My XML is like below:
<chapter id="i120" page-num="1" extra-info="CHAPTER 1">
<title id="i121" page-num="1">Introduction to Corporate Finance</title>
<chbeginning id="i122" page-num="1" extra-info="Chapter Opener">
<title id="i123" page-num="1">OPENING CASE</title>
<para id="i124" page-num="1" dropcap="yes">Apple began as a
two-man....million.</para>
<para id="i125" page-num="1">Despite...altogether.</para>
<para id="i126" page-num="1">Of course... Steven Jobs!</para>
<para id="i127" page-num="1">With ... 74 days.</para>
</chbeginning>
<chbody id="i128" page-num="1" extra-info="Chapter Body">
<section id="i129" page-num="1">
<title id="i130" page-num="1">1.1 WHAT IS CORPORATE
FINANCE?</title>
<sectbody id="i131" page-num="1">
<para id="i132" page-num="1">Suppose...
firm.</para>
<subsection id="i133" page-num="2">
<title id="i134" page-num="2">The
Balanc.. Firm</title>
<para id="i135" page-num="2">Suppose
... finance.</para>
In the above XML, page-num attribute is there for all the elements. My
requirement is that to display the value of the page-num attribute
only first time. Means i should display the page-num at where the
value is changing. We don't know on which node the value will change
it may be child, it may be sibling.
I have used the following code in the root template to achieve this
action but failed.
<xsl:template match="/">
<xsl:for-each select="@page-num">
<xsl:if test="self::*/@page-num !=
following::*/@page-num"><xsl:value-of
select="current()/@page-num"/></xsl:if>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:template>
Please guide me where I am going wrong.
Regards,
Ganesh
--~------------------------------------------------------------------
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>
--~--