[xsl] xsl:element start/end tags when need to recurse

Subject: [xsl] xsl:element start/end tags when need to recurse
From: Peter.A.Lom@xxxxxxxxxx
Date: Wed, 30 Apr 2008 09:16:09 +1000
Please advise:

I am using Windows XP and xslt 1.0 transformation (Delphi interface to MS 
parser)..


Need to transform 
<?xml version="1.0" encoding="UTF-8"?>
<rules>
       <a items="AAA=121 Fake Street|BBB=323 Club Road|"/>
</rules>

Into a new one:

<rules>
<a items="AAA=121 Fake Street|BBB=323 Club Road|">
 <group value="addingCases">
        <a_child item="AAA=123 Fake Street">
                <a_grand value="1"/> 
        </a_child>
        <a_child item="BBB=323 Club Road">
                <a_grand value="2"/> 
        </a_child>
</group>
</a> 
</rules>


I can achieve this using <xsl:text disable-output="yes"> but the correct 
way is via 
<xsl:element>
 .......?????
      cannot use call-template
      what else I can use here ?
</xsl:element>

Advise on how to do that is much appreciated.

Thanks
Peter
=============

 
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"; version 
= "1.0" > 
          <xsl:output method = "xml" indent = "yes" /> 
 
<xsl:variable  name="newline" select="'&#xA;'"/> 

<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
        <xsl:apply-templates>
                <xsl:with-param name="level">1</xsl:with-param>
        </xsl:apply-templates>
  </xsl:copy>
</xsl:template>

<xsl:template name="tokenize" match="//rules/a">
   <xsl:param name="level"/> 
   <xsl:param name="currAddress" select="@items" />

  <xsl:choose>
    <xsl:when test="contains($currAddress,'|') and ($currAddress !='' ">   
 
        <xsl:element name="a_item"> 
        <xsl:element name="a_group"> 
<!-- CANNOT USE BUT  I DON'T KNOW ALTERNATIVE -->
                <xsl:attribute name="value">addition</xsl:attribute>  
                <xsl:call-template name="tokenizeChild" 
match="//rules/a/a_items/a_group"> 
                       <xsl:with-param name="level" select="$level+1"/>  
                       <xsl:with-param name="" select="$currAddress/>  
                </xsl:call-template>
        </xsl:element> <!--  name="a_group" --> 
  </xsl:when> 
<xsl:otherwise>
 ..............
</xsl:otherwise>
  </xsl:choose> 
 
 </xsl:template>
 
</xsl:stylesheet>



National Australia Bank Ltd - ABN 12 004 044 937
This email may contain confidential information. If you are not the intended
recipient, please immediately notify us at postmaster@xxxxxxxxxx or by replying to
the sender, and then destroy all copies of this email. Except where this email
indicates otherwise, views expressed in this email are those of the sender and not
of National Australia Bank Ltd. Advice in this email does not take account of your
objectives, financial situation, or needs. It is important for you to consider these
matters and, if the e-mail refers to a product(s), you should read the relevant
Product Disclosure Statement(s)/other disclosure document(s) before making any
decisions. If you do not want email marketing from us in future, forward this email
with "unsubscribe" in the subject line to Unsubscriptions@xxxxxxxxxx in order to
stop marketing emails from this sender. National Australia Bank Ltd does not
represent that this email is free of errors, viruses or interference.

Current Thread