xsl-list
[Top] [All Lists]

RE: xsl apply template is not working

2005-04-27 01:14:19
<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(_dot_)gangula(_at_)wipro(_dot_)com 
[mailto:sreekanth(_dot_)gangula(_at_)wipro(_dot_)com] 
Sent: 27 April 2005 08:13
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)wipro(_dot_)com immediately
and destroy all copies of this message and any attachments.

--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>