xsl-list
[Top] [All Lists]

WG: multiple select with key

2005-04-07 13:47:59
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(_at_)codeworx(_dot_)info
I www.codeworx.info 


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • WG: multiple select with key, Studio Codeworx <=