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

Using a path expression stored in the xml file ?

Subject: Using a path expression stored in the xml file ?
From: Jean-Christophe <pazzaglia@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 23 Jun 1999 19:20:33 +0100
the chief is always right
Hi,

I wonder if it is possible to use a path which is stored
in the xMl file while processing it with xsl, (see example
I made several tries with lotusxsl and oracle without success)

I know that it sounds like an heresy  for XSL experts :)
but more generally this question will raise the problem of the
evaluation of the path which is not clear for me (Let's say
that I was happier with parenthesis,quote, backquote and coma
instead of brackets, dollar and strings !).

If there is no answer.

"Dear XSLT submitters (?)
  Maybe symmetrically to string(expr) it will be nice to have a expr(string)
or a path(string)?"


thanks in advance

jc

example:
xml:
<laws>
 <law-a right="chief"> The chief is right </law-a>
 <law-b right="../law-a/@right"> The chief is always  right!</law-b>
 <law-c right="from-parent(node())/from-children(law-a)/@right"> Even if the
chief is wrong, the chief is right!</law-c>
</laws>


xsl:

<?xml version='1.0'?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns="http://www.w3.org/TR/REC-html40" >

<xsl:template match='/'>
   <HTML>
   <HEAD>
      <TITLE>Laws</TITLE>
   </HEAD>
   <BODY>
     <xsl:apply-templates select="laws/*" />
   </BODY>
   </HTML>
</xsl:template>


<xsl:template match="law-a">
 <xsl:variable name="rec" expr="./@right" />
     <p> <xsl:value-of select="text()"/> </p>
     <p> who is right : <xsl:value-of select="$rec" /> </p>
</xsl:template>

<!-- what do I have to use instead of "$rec" below  -->
<!-- to use the value of the variable as a path ? -->

<xsl:template match="law-b">
 <xsl:variable name="rec" expr="./@right" />
     <p> <xsl:value-of select="text()"/> </p>
     <p> who is right : <xsl:value-of select="$rec" /> (<xsl:value-of
select="../law-a/@right" />)</p>
</xsl:template>

<xsl:template match="law-c">
 <xsl:variable name="rec" expr="./@right" />
     <p> <xsl:value-of select="text()"/> </p>
     <p> who is right : <xsl:value-of select="$rec" /> (<xsl:value-of
select="from-parent(node())/from-children(law-a)/@right" />) </p>
</xsl:template>

</xsl:stylesheet>


--
Dr Jean-Christophe Pazzaglia  mailto:pazzaglia@xxxxxxxxxxxxxxxxxxx
------------------------------------------------------------------
Mediatech S.R.L                         http://mediatech.didael.it
SMail: CP 100 - 09018 Sarroch (CA), Italy
Office: 6° Strada Ovest, Loc. Macchiareddu, 09010 Uta (CA), Italy
Tel: (+39) 070 2466 5010                  Fax: (+39) 070 2466 5111

begin:vcard 
n:Pazzaglia;Jean-Christophe
tel;fax:+39-070-24665111
tel;work:+39-070-24665010
x-mozilla-html:FALSE
url:http://mediatech.didael.it
org:Mediatech;Research
adr:;;Casella Postale 100;Sarroch;CA;09018;Italy
version:2.1
email;internet:pazzaglia@xxxxxxxxxxxxxxxxxxx
title:Dr
note;quoted-printable:Office location (not for mail)=0D=0ACitt=E0 dell'Innovazione=0D=0A6 Strada Ovest =0D=0ALoc Macchiareddu=0D=0A09010 Uta (CA)=0D=0AItaly
fn:Jean-Christophe
end:vcard
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.