Subject: [xsl] WG: key multiple select From: "Studio Codeworx" <studio@xxxxxxxxxxxxx> Date: Mon, 4 Apr 2005 14:30:34 +0200 |
Hi again, I have corrected the key for 'pageid' <xsl:variable name="pageid" select="$dfile[key('pageid', concat(id, '+', $catid))]"/> but the key still has no results. Please, I don't know a solution for this problem after days, working on it... regards, christian schlemmer -----Urspr|ngliche Nachricht----- Von: Studio Codeworx [mailto:studio@xxxxxxxxxxxxx] Gesendet: Sonntag, 03. April 2005 20:36 An: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' Betreff: xsl:key multiple select Hi, for designing a navigation bar a loop walks through all category names stored in a single document. Inside Loop I'm using a key to ask a second document if the current categoryname also exists as pagename. if yes, the output is the categoryname formated as HREF. if no, a dropdown-menu will created. this output works fine. the problem HREF needs the current page-id corresponding the category-id. id-node "category" is the relation inside page document. my solution using a second key (pageid) requesting the id corresponding to node 'category' = $catid. I think, concat() could make the criteria asking, but dont't know how to get it work. <xsl:variable name="dfile" select="document($datafile)"/> <xsl:key name="pagename" match="siteinfo/pages/page/name" use="."/> <xsl:key name="pageid" match="siteinfo/pages/page/id" use="concat(id, '+', category)"/> <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" select="$dfile[key('pageid', concat(id, $catid))]"/> <xsl:choose> <xsl:when test="$pagename"> <xsl:if test="$pageid"> ,"<xsl:value-of select="pageid" disable-output-escaping="yes"/><xsl:value-of select="$nbsp" disable-output-escaping="yes"/><xsl:value-of select="$not" disable-output-escaping="yes"/><xsl:value-of select="$nbsp" disable-output-escaping="yes"/><xsl:value-of select="$catname"/>","default.asp?id=<xsl:value-of select="id"/>&mnu=<xsl:value-of select="id"/>","","<xsl:value-of select="$catname"/>",0 </xsl:if> </xsl:when> <xsl:otherwise> ,"<xsl:value-of select="pageid" disable-output-escaping="yes"/><xsl:value-of select="$nbsp" disable-output-escaping="yes"/><xsl:value-of select="$not" disable-output-escaping="yes"/><xsl:value-of select="$nbsp" disable-output-escaping="yes"/><xsl:value-of select="$catname"/><xsl:value-of select="$nbsp" disable-output-escaping="yes"/>","show-menu=<xsl:value-of select="$catname"/>",,"",1 </xsl:otherwise> </xsl:choose> </xsl:for-each> the input pages - <siteinfo> + <data> + <editorsettings> + <pages> + <page> - <name> <![CDATA[SERVICE]] </name> - <category> <![CDATA[1]] </category> </page> + <page> . . . categorys - <categories> - <category> <id> <![CDATA[1]] </id> <name> <![CDATA[SERVICE]] </name> </category> . . . would be appreciated for advises. 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to use an image path , Beena Abraham | Thread | Re: [xsl] WG: key multiple select, David Carlisle |
RE: [xsl] How to use an image path , cknell | Date | RE: [xsl] Testing 2 XML documents f, Mukul Gandhi |
Month |