[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Using "variable" in a select...


Subject: [xsl] Using "variable" in a select...
From: Michel.Baily@xxxxxxxxxxxxxxxxx
Date: Thu, 18 Sep 2003 16:02:39 +0200


Dear All,

Im currently working on an XSL-FO project needing multiple languages
documents.

I've an XML document containing the data to be written :

<Attest year="2002" documentDate="21/08/2003">
   <Taker>
      <Name>
         Adam Dure
      </Name>
      <Address>
          <Street>
            Katrienwiel 6
          </Street>
          ...
          ...
      </Address>
      ...
      ...
   </Taker>
   ...
   ...
</Attest>

I've an XSL document used to transform XML into PDF using FOP.

To allow easiest maintenance, I've placed all the document static texts
into an other XML file like the one below :

<?xml version='1.0' encoding="UTF-8" ?>
<Texts>
        <Loan>
                <LoanNr lang="nl">Hypotecaire leningen Nr</LoanNr>
                <LoanNr lang="fr">Prêt hypotécaire  Nr</LoanNr>
                <Year lang="nl">Dienst jaar</Year>
                <Year lang="fr">Année</Year>
                ...
                ...
        </Loan>
</Texts>

To acces the texts, I use such construction :

<xsl:template match="Loan">
   ...
   <xsl:value-of select="document('fiscalAttestsTxt.xml')/Texts/Loan/LoanNr
[@lang='nl']"/>
   ...
</xsl:template>

My question :
In place of using a litteral value for the lang(uage) attribute, I would
like to use a value extracted from  my original xml file.
For example, I could add  lang attribute to the Attest tag.
...
<Attest year="2002" documentDate="21/08/2003" lang="fr">
   <Taker>
      <Name>
         Adam Dure
      </Name>
      ...
      ...
   </Taker>
   ...
   ...
</Attest>

How can I reference this lang attribute as parameter  in my select criteria
?
Remark : This value will change from Attest to Attest...

Thanks in advance

Michel



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords