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(_at_)codeworx(_dot_)info]
Gesendet: Sonntag, 03. April 2005 20:36
An: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
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(_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>
--~--