<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(_at_)sift(_dot_)info> wrote in message
news:001801c3773c$ab244590$6600a8c0(_at_)tlebo(_dot_)(_dot_)(_dot_)
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[(_at_)rdf:ID=$myIDREF])"/>
<xsl:apply-templates select="//thing[(_at_)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