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

Re: Simple template matching problem

Subject: Re: Simple template matching problem
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 07 May 2007 23:40:49 +0200
Re:  Simple template matching problem
Steve wrote:
I have a problem with the below templates. The first template
*ideally* displays a bunch of input fields, based on the table's
structure as defined by $invTable.

The second template *ideally* creates a single form control (there are
several besides 'varchar'/'float')

My problem is that when the top template is "Records/Record" I'm
getting infinite recursion loop. When I use match "Records" all is
fine. I suspect its because of a template mismatch.

You suspect correct. You match for "Records/Record", which translates as: "Any element 'Record' that has a parent of 'Records' ". However, you seem to think of it as "Any element 'Records' with one or more 'Record' elements as children".


What you need is: match="Records[Record]" (you need a predicate, not a child specification).


<xsl:template match="Records/Record"> <xsl:apply-templates select="$invTable[COLUMN_NAME='beginDate']"> <xsl:with-param name="value" select="//beginDate" />

btw, why do you need this? First of all, it is not there in the source, secondly (assuming your sample source is different than your real source), if the data is there, you can get it from the matching templates as well (or the matching templates have different sources, but the same elements, in which case I recommend that you switch modes as well, to keep from accidental infinite recursion).


   </xsl:apply-templates>
</xsl:template>

<xsl:template match="Record[DATA_TYPE='varchar' or DATA_TYPE='float']">
   <appropriateInputBox />
</xsl:template>




Cheers,
-- Abel

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.