[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using an xsl:variable within an xsl:apply-template

Subject: 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 apply template variable
>      <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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.