RE: [xsl] xsl apply template is not working

Subject: RE: [xsl] xsl apply template is not working
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 27 Apr 2005 09:14:19 +0100
<xsl:for-each select="Transaction">
	<Transaction>
	<xsl:apply-templates select="Transaction"/>

Within for-each, the context node is a Transaction.

Your apply-templates is short for select="./child::Transaction", but a
Transaction does not have any Transaction children.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: sreekanth.gangula@xxxxxxxxx 
> [mailto:sreekanth.gangula@xxxxxxxxx] 
> Sent: 27 April 2005 08:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] xsl apply template is not working
> 
> 
> Hi All,
>   My apply template is not working.
> <xsl:apply-templates select="Header"/> is going inside the 
> 
>       <xsl:template match="Header">
> 		<xsl:copy-of select="test"/>
> 	</xsl:template>
> But the following apply templates are not going inside template match:
> <xsl:apply-templates select="Transaction"/>
> <xsl:apply-templates select="Meterpoint"/>
> <xsl:apply-templates select="Address"/>
> Is not going inside the corresponding template match.
> Could anyone please help me.
> My Source XML:
> <Root>
> 	<Header>
> 		<test>Sreekanth</test>
> 	</Header>
> 	<Transaction>
> 		<test1>Sreekanth</test1>
> 	</Transaction>
> 	<Meterpoint>
> 		<test>Sreekanth</test>
> 	</Meterpoint>
> 	<Address>
> 		<test>Sreekanth</test>
> 	</Address>
> 	<Asset>
> 		<test>Sreekanth</test>
> 	</Asset>
> 	<Transaction>
> 		<test>Sreekanth</test>
> 	</Transaction>
> 	<Meterpoint>
> 		<test>Sreekanth</test>
> 	</Meterpoint>
> 	<Address>
> 		<test>Sreekanth</test>
> 	</Address>
> 	<Asset>
> 		<test>Sreekanth</test>
> 	</Asset>
> 	<Transaction>
> 		<test>Sreekanth</test>
> 	</Transaction>
> 	<Meterpoint>
> 		<test>Sreekanth</test>
> 	</Meterpoint>
> 	<Address>
> 		<test>Sreekanth</test>
> 	</Address>
> 	<Asset>
> 		<test>Sreekanth</test>
> 	</Asset>
> </Root>
> 
> My XSL:
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 	<xsl:output method="xml"/>
> 	<xsl:template match="Root">
> 		<IDOC>
> 			<HEADER>
> 				<xsl:apply-templates select="Header"/>
> 				<xsl:for-each select="Transaction">
> 					<Transaction>
> 						<xsl:apply-templates
> select="Transaction"/>
> 						<MeterPoint>
> 						
> 
> 
> 							<Address>
> 
> 
> <xsl:apply-templates select="Address"/>
> 							</Address>
> 							<Asset>
> 
> 
> <xsl:apply-templates select="Asset"/>
> 							</Asset>
> 						</MeterPoint>
> 					</Transaction>
> 				</xsl:for-each>
> 			</HEADER>
> 		</IDOC>
> 	</xsl:template>
> 	<xsl:template match="Header">
> 		<xsl:copy-of select="test"/>
> 	</xsl:template>
> 	<xsl:template match="Transaction">
> 		<xsl:copy-of select="test1"/>
> 	</xsl:template>
> 	<xsl:template match="Meterpoint">
> 		<xsl:copy-of select="test"/>
> 	</xsl:template>
> 	<xsl:template match="Address">
> 		<xsl:copy-of select="test"/>
> 	</xsl:template>
> 	<xsl:template match="Asset">
> 		<xsl:copy-of select="test"/>
> 	</xsl:template>
> </xsl:stylesheet>
> 
> 
> 
> Confidentiality Notice
> 
> 
> The information contained in this electronic message and any 
> attachments to this message are intended
> for the exclusive use of the addressee(s) and may contain 
> confidential or privileged information. If
> you are not the intended recipient, please notify the sender 
> at Wipro or Mailadmin@xxxxxxxxx immediately
> and destroy all copies of this message and any attachments.

Current Thread