|
Subject: [xsl] Re: Using an xsl:variable within an xsl:apply-templates select From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx> Date: Wed, 10 Sep 2003 06:49:04 +0200 |
> <xsl:for-each select="*/@resource">
> <xsl:variable name="myIDREF" select="."/>
Must be:
<xsl:for-each select="*/@rdf:resource">
<xsl:variable name="myIDREF" select="."/>
=====
Cheers,
Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL
"Timothy M. Lebo" <tlebo@xxxxxxxxx> wrote in message
news:001801c3773c$ab244590$6600a8c0@xxxxxxxx
> Hello,
>
> I am calling the following template with an Xpath expression to limit
> the number of element nodes that are processed from an input document.
> While processing these nodes, I want to process the current node and
> each element that the context node refers to (and nothing more).
>
> For example, let thing 1 be the node set that this template is applied
> to. This template will process thing 1 and thing 2, but not thing 3
> because it is not referred to by thing 1.
>
> Sample input:
> <thing rdf:ID="1">
> <likes rdf:resource="2"/>
> </thing>
>
> <thing rdf:ID="2">
> <likes rdf:resource="3"/>
> </thing>
>
> <thing rdf:ID="3">
> <likes rdf:resource="4"/>
> </thing>
>
>
> My question: Is it permitted to use an xsl:variable within the
> xsl:apply-templates select attribute as I do below? The value-of count
> is returning 0 when there exists a thing with an rdf:ID that matches the
> contents of the myIDREF variable. Could my Xpath expression be
> incorrect?
>
> Also: I am not using the id() or key functions because I would think
> that my described technique should work. If the either technique is
> applicable and cleaner, I would appreciate the advice.
>
> <xsl:template match="thing" mode="gather">
> <!-- Process current node -->
> <xsl:apply-templates select="." mode="process"/>
> <!-- Process nodes that I refer to -->
> <xsl:for-each select="*/@resource">
> <xsl:variable name="myIDREF" select="."/>
> <xsl:value-of select="$myIDREF"/>
> <xsl:value-of select="count(//thing[@rdf:ID=$myIDREF])"/>
> <xsl:apply-templates select="//thing[@rdf:ID=$myIDREF]"
> mode="process"/> <!-- HERE -->
> </xsl:for-each>
> </xsl:template>
>
> <xsl:template match="thing" mode="process">
> <!-- Do stuff, but don't apply-templates to things I refer to
> -->
> </xsl:template>
>
> The rdf namespace is defined and matches that of the input namespace
> declaration.
>
> Regards,
>
> Timothy M. Lebo
> Research Associate
> Smart Information Flow Technologies
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Using an xsl:variable within , Timothy M. Lebo | Thread | RE: [xsl] Using an xsl:variable wit, Michael Kay |
| [xsl] Building a html menu using in, ausec | Date | RE: [xsl] Building a html menu usin, Jarno . Elovirta |
| Month |