On Tue, Jan 25, 2011 at 11:19 PM, Vineet Chaoji <vineetc@xxxxxxxxx> wrote:
>> XPath is not often used by itself. Using XQuery or XSLT would provide
>> constructs such as user-defined functions, variable bindings and/or
>> recursion on top of XPath, to ease the task. Are either of these an
>> option?
>
> Yes, all these are good options. I am quite new to both XQuery and
> XSLT. Could you please point me to where I could start to understand
> the differences? How do these do variable bindings?
The W3C's XSL [1] and XQuery [2] pages each list several tutorials.
Google will certainly give you additional options.
XSLT code might look something like this (as part of a complete
transform/stylesheet, of course):
<xsl:variable name="b" select="//Book[@rdf:about='Book1']"/>
<xsl:variable name="c1" select="//*[@rdf:about =
$b/chapter/@rdf:resource] | $b/chapter/*"/>
<xsl:variable name="s1" select="//*[@rdf:about =
$c1/section/@rdf:resource] | $c1/section/*"/>
<xsl:variable name="a" select="//Article[@rdf:about =
$s1/section/@rdf:resource] | $s1/section/Article"/>
<xsl:variable name="c2" select="//*[@rdf:about =
$a/chapter/@rdf:resource] | $a/chapter/*"/>
<xsl:variable name="s" select="//*[@rdf:about =
$c2/section/@rdf:resource] | $c2/section/*"/>
<xsl:value-of select="boolean($s/figure[. = '"Example
semi-join"'])"/>
-Brandon :)
[1] http://www.w3.org/Style/XSL/
[2] http://www.w3.org/XML/Query/
|