[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xslt 1, node sets in variables
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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|