Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] Displaying Unique attribute value

From: "Ganesh Babu N" <nbabuganesh@--------->
To:
Date: 10/3/2008 1:13:00 PM
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


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent