Re: [xslt] Intermittent problem.



Sai,

i would write the template much differently, i have attached the xsl 
that i created, it works for the test case provided, i did not test it 
thouroghly - i dont understand your code yet - was easier to start over 
( i am just learning too )

darrell

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:output method="xml" indent="yes"/>


  <!--Match children of root node, Request-->
  <xsl:template match="/Request">
    <xsl:element name="Request">
      <xsl:apply-templates select="./*"/>
    </xsl:element>
  </xsl:template>

  <xsl:template match="*">
    <xsl:if test="name()='complexElem'">
      <xsl:element name="node">
        <xsl:attribute name="name" >complexElem</xsl:attribute>
        <xsl:apply-templates select="./*" />  
      </xsl:element>
    </xsl:if>
    <xsl:if test="name()!='complexElem'">
      <xsl:element name="node">
        <xsl:attribute name="name">
          <xsl:value-of select="name()" />
        </xsl:attribute>
        <xsl:attribute name="value"  >
          <xsl:value-of select="text()" />
        </xsl:attribute>
      </xsl:element>
    </xsl:if>
  </xsl:template>

</xsl:stylesheet>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]