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

xslt 1, node sets in variables

Subject: xslt 1, node sets in variables
From: Joelle Tegwen <tegwe002@xxxxxxx>
Date: Fri, 31 Jul 2009 15:39:42 -0500
 xslt 1
From my research on the web, it seems like I should be able to do this, but I can't seem to make it work. How can I get a node set into a variable so that I can do processing on it before it goes to the new template? (or some other way to get the same functionality.

I'm using xslt 1, using libxml via php.

Any help or pointers would be appreciated.

My xml varies (sometimes the projects are nested deeper, etc) but the general point is
<projects>
<project @active="1" @new="1">stuff</project>
<project @active="2" @new="0">stuff</project>
<project @active="0" @new="0">stuff</project>
etc.
</projects>


The error I'm getting is:
**public_project_list_display.xsl line 76 element apply-templates
The 'select' expression did not evaluate to a node set.
**
The stylesheet is

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">
<xsl:template match="projects">
<xsl:choose>
<xsl:when test="$active_filter = 'active'">
<xsl:copy-of select="project[@active!=0]"/>
</xsl:when>
<xsl:when test="$active_filter = 'archived'">
<xsl:copy-of select="project[@active=0]"/>
</xsl:when>
<xsl:when test="$active_filter = 'new'">
<xsl:copy-of select="project[@new=1]"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="project"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="count(exsl:node-set($projects))"/>
<xsl:value-of select="name(exsl:node-set($projects)[1])"/>
<xsl:choose>
<xsl:when test="count(exsl:node-set($projects))>10">
<xsl:call-template name="pagenated">
<xsl:with-param name="projects" select="exsl:node-set($projects)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="not_pagenated">
<xsl:with-param name="projects" select="exsl:node-set($projects)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template name="not_pagenated">
<xsl:param name="projects"/>
<ul class="list-menu results">
<xsl:apply-templates select="$projects"> <-- line 76
<xsl:sort select="@sort_key"/>
</xsl:apply-templates>
</ul>
</xsl:template>



Thanks for your time. Joelle

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.