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

RE: newbie: problems computing output from variables

Subject: RE: newbie: problems computing output from variables
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 7 Feb 2001 12:49:08 -0000
RE:  newbie: problems computing output from variables
> My xsl (fumblings) are:
>
> <xsl:template match="/">
> ...
> <xsl:variable name="edits" select="id != edit_id"/>
> <xsl:variable name="editvase" select="$edits[position() &lt; 6]"/>
> <xsl:for-each select="/faqs/faq">
> <xsl:choose>
> <xsl:when test="$edits">
> <xsl:value-of select="$question"/><br/>
>
Your're setting $edits to a value: true if the root node has an <id> child
and an <edit_id> child with the same string value. It doesn't, so $edits is
always false.

Then you're trying to select those nodes in $edits whose position is less
than 6. But $edits is false, it doesn't contain any nodes, so the selection
is meaningless.

I think you wanted $edits to be an expression which is evaluated later:
that's not the way it works.

You don't need variables at all here, just:

<xsl:for-each select="faqs/faq[id!=edit_id][position() &lt; 6]">
  <xsl:value-of select="question"/><br/>

Mike Kay


 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.