[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

problem with preceding axis

Subject: problem with preceding axis
From: kalpana rawat <kal_xml@xxxxxxxxx>
Date: Wed, 10 Oct 2001 10:23:25 -0700 (PDT)
axis disable output escaping
Could anybody tell me how to solve this problem. My
problem is that I use
[not(@ID=preceding::Document/@ID)] which protects the
next Documents, having same ID, to be displayed but I
can't avoid writing [not(@ID=preceding::Document/@ID)]
also.

XML is:

	 <Item Type="Annual" ID="2701">
    <Title><![CDATA[Item 2.2 title]]></Title>
		<Attr ID="1">
			<Name>X</Name>
			<Year Value="1999">
				<Document ID="1" Title="Doc 1">
					<Value>Doc 1 Value of Year 1999 attr X</Value>
				</Document>
				<Document ID="2" Title="Doc 2">
					<Value>Doc 2 Value of Year 1999 attr X</Value>
				</Document>
			</Year>
			<Year Value="2000">
				<Document ID="1" Title="Doc 1">
					<Value>Doc 1 Value of Year 2000 attr X</Value>
				</Document>
				<Document ID="2" Title="Doc 2">
					<Value>Doc 2 Value of Year 2000 attr X</Value>
				</Document>
			</Year>
		</Attr>
		<Attr ID="2">
			<Name>Y</Name>
			<Year Value="1999">
				<Document ID="1" Title="Doc 1">
					<Value>Doc 1 Value of Year 1999 attr Y</Value>
				</Document>
				<Document ID="2" Title="Doc 2">
					<Value>Doc 2 Value of Year 1999 attr Y</Value>
				</Document>
			</Year>
			<Year Value="2000">
				<Document ID="1" Title="Doc 1">
					<Value>Doc 1 Value of Year 2000 attr Y</Value>
				</Document>
				<Document ID="2" Title="Doc 2">
					<Value>Doc 2 Value of Year 2000 attr Y</Value>
				</Document>
			</Year>
		</Attr>
   </Item>

XSL is:

<xsl:for-each select="Attr">

<table width="98%" border="1" cellpadding="4"
cellspacing="0" align="center">
	
	<tr>
		<td class="cssheader11">
			<xsl:value-of select="Name"
disable-output-escaping="yes"/>
		</td>
		<xsl:for-each select="Year">
		<td class="cssheader11">
			<xsl:value-of select="@Value"
disable-output-escaping="yes"/>
		</td>
		</xsl:for-each>
	</tr>
	
	<xsl:for-each
select="Year/Document[not(@ID=preceding::Document/@ID)]">
	
	<xsl:variable name="varDocID" select="@ID" />
	<xsl:variable name="varYear" select="../@Value" />
	<tr>
		<td class="cssbody11">
			<xsl:value-of select="@Title"
disable-output-escaping="yes"/>
		</td>
		<xsl:for-each
select="../../Year/Document[@ID=$varDocID]/Value">
		<td class="cssbody11">
			<xsl:value-of select="."
disable-output-escaping="yes"/>
		</td>
		</xsl:for-each>
	</tr>
	</xsl:for-each>
		
</table><BR/><BR/>
</xsl:for-each>

output:

<table align="center" cellspacing="0" cellpadding="4"
border="0" width="98%">
<tr>
<td class="cssbody12blue"><a name="2701"><b>Item 2.2
title</b></a></td>
</tr>
</table>
<table align="center" cellspacing="0" cellpadding="4"
border="1" width="98%">
<tr>
<td class="cssheader11">X</td><td
class="cssheader11">1999</td><td
class="cssheader11">2000</td>
</tr>
<tr>
<td class="cssbody11">Doc 1</td><td
class="cssbody11">Doc 1 Value of Year 1999 attr
X</td><td class="cssbody11">Doc 1 Value of Year 2000
attr X</td>
</tr>
<tr>
<td class="cssbody11">Doc 2</td><td
class="cssbody11">Doc 2 Value of Year 1999 attr
X</td><td class="cssbody11">Doc 2 Value of Year 2000
attr X</td>
</tr>
</table>
<BR>
<BR>
<table align="center" cellspacing="0" cellpadding="4"
border="1" width="98%">
<tr>
<td class="cssheader11">Y</td><td
class="cssheader11">1999</td><td
class="cssheader11">2000</td>
</tr>
</table>

Thanks

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.