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

WG: multiple select with key

Subject: WG: multiple select with key
From: "Studio Codeworx" <studio@xxxxxxxxxxxxx>
Date: Thu, 7 Apr 2005 22:47:59 +0200
xsl for each multiple select
hi david,

thx for reply.

this was the incentive for me to solve it.
---------------------------------->
The current node after $dfile[ is the root node (/) of the document
referenced by $datafile) so the first id used in your concat(id  will be the
empty string unless id is the top level element of $datafile, and will be
the whole string content of $datafile if its top level element is id. I
doubt this is what you intended, but can't suggest a fix given teh available
information.
<----------------------------------

The solution was to make a loop which selects the pageid corresponding to
the category-id relation.

<xsl:variable name="dfile" select="document($datafile)"/> <xsl:key
name="pagename" match="siteinfo/pages/page" use="name"/>

<xsl:for-each
select="document($categoryfile)//categories/category[visible!='off' and
id!=0 and member='off']">
	<xsl:variable name="catname" select="catname"/>
	<xsl:variable name="catid" select="id"/>
	<xsl:variable name="pagename" select="$dfile[key('pagename',
$catname)]"/>
			
	<xsl:variable name="pageid">
		<xsl:for-each
select="document($datafile)//siteinfo/pages/page[category=$catid]">
			<xsl:variable name="pid" select="id"/>
			<xsl:value-of select="id"/>
		</xsl:for-each>
	</xsl:variable>
		  			    
	<xsl:choose>				
		<!-- the 'test=' expression converts the returned nodeset of
xsl:key to a boolean value, therefore it can be requested for true() or
false() -->
		<xsl:when test="$pagename">
		,"<xsl:value-of select="$nbsp"/><xsl:value-of
select="$not"/><xsl:value-of select="$nbsp"/><xsl:value-of
select="$catname"/>","default.asp?id=<xsl:value-of
select="$pageid"/>&amp;mnu=<xsl:value-of
select="$pageid"/>","","<xsl:value-of select="$catname"/>",0		
		</xsl:when>
		<xsl:otherwise>					
		,"<xsl:value-of select="$nbsp"/><xsl:value-of
select="$not"/><xsl:value-of select="$nbsp"/><xsl:value-of
select="$catname"/><xsl:value-of
select="$nbsp"/>","show-menu=<xsl:value-of select="$catname"/>",,"",1

		</xsl:otherwise>
	</xsl:choose>

</xsl:for-each>

regards,
christian schlemmer

>> Codeworx <<
Vorstadt 17a
A-6800 Feldkirch
T +43 664 3044577
F +43 5522 84280
E studio@xxxxxxxxxxxxx
I www.codeworx.info 

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.