qexo-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qexo-general] Re: Quexo question


From: Per Bothner
Subject: [Qexo-general] Re: Quexo question
Date: Wed, 29 Oct 2003 08:26:04 -0800
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030827

Stan Pinte wrote:

--> I am trying to use Xquery, to be able to compute some values in an XML document, using values defined in this documents. In this very example, I am trying to print out the value of an attribute of a tag specified above...I would like for example to perform numerical operations on them.

I guess if you're careful you could write a write a file that is both valid XML and valid XQuery. Then you could use a call the doc("thix.xml") to access the document, or you could use the (not-yet implemented Qexo feature to bind the top-level focus.

I suspect XSLT would work better for you.  You can use XSLT's
"simplified stylesheets".  For example:

<result xsl:version="1.1"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <field name="one" value="11"/>
    <field name="two" value="12"/>
    <computed name="hehe" value="{sum(result/field/@value)}"/>
</result>

Running this through Saxon (7.6.5) and specifying the same filename for both the input document and teh stylesheet, I get:

<?xml version="1.0" encoding="UTF-8"?><result><field name="one" value="11"/><field name="two" value="12"/><computed name="hehe" value="23"/></result>
--
        --Per Bothner
address@hidden   http://per.bothner.com/






reply via email to

[Prev in Thread] Current Thread [Next in Thread]