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

RE: xsl apply template is not working

Subject: RE: xsl apply template is not working
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 27 Apr 2005 09:14:19 +0100
xsl apply template
<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 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

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.