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

call-templates

Subject: call-templates
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Thu, 07 Feb 2002 12:50:59 +0000
call templates
Hello again,

I seem to have one problem more.

I thought that I understood <xsl:call-template ..> but it seems not to be the case.

I am given the job of transforming an XML document to another XML document. In the original document, the values contained in the nodes depend on the type attribute. The output XML document should have nodes which name tells something about the values.

Testing my solution on IE. 6.0 I get the following error:
Keyword xsl:call-templates may not be used here.

I am totally blank - none of the examples I have found gives me any reason for the behavior.

Sincerly
Ragulf Pickaxe :)

XML fragment:

<root>
 <DataList>
   <Data Type="101"><Node1>Value1</Node1><Node2></Node2></Data>
   <Data Type="102"><Node1>Value1</Node1><Node2>Value2</Node2></Data>
   <Data Type="103"><Node1>Value1</Node1><Node2></Node2></Data>
   <Data Type="201"><Node1>Value1</Node1><Node2>Value3</Node2></Data>
   <Data Type="202"><Node1>Value1</Node1><Node2>Value3</Node2></Data>
 </DataList>
</root>

XSL fragment:

<xsl:template match="DataList">
 <xsl:choose>
   <xsl:when test="@Type='101' or @Type='102' or @Type='103'">
 <!-- Not having implemented the solution to my last question. -->
     <xsl:call-templates name="Do-Something"/>
   </xsl:when>
   <xsl:when test="@Type='201' or @Type='202' or @Type='203'">
     <xsl:call-templates name="Do-Something-Else"/>
   </xsl:when>
   <xsl:otherwise></xsl:otherwise>
 </xsl:choose>
</xsl:template>

<xsl:template name="Do-Something">
 <This><xsl:value-of select="Node1"/></This>
 <xsl:if test="Type='102'">
   <That><xsl:value-of select="Node2"/></That>
 </xsl:if>
</xsl:template>

<xsl:template name="Do-Something-Else">
 <This><xsl:value-of select="Node1"/></This>
 <AnotherThat><xsl:value-of select="Node2"/></AnotherThat>
</xsl:template>


_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



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.