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

How to select elements based on the value(s) of a mult

Subject: How to select elements based on the value(s) of a multi-valued attribute?
From: "Rogier Hofboer" <hofboer@xxxxxxxxx>
Date: Mon, 28 Jan 2002 17:04:45 +0100
Hi everybody,

Can somebody help me to solve the following problem?
A resource can be translated into more languages
(and multiple times in the same language) and every
translation in that language is applicable for one or
more countries. This is because if one language is
spoken in more countries, some resources are translated
once i.e. the translations for the word "Name" but the
text on the homepage is translated more times in the same
language but each translation is appropiate for another country.


<resource name="hello">
    <!-- translation in french for france and belgium -->
    <!-- translation in dutch for belgium -->
    <!-- translation in dutch for the netherlands -->
    <!-- translation in english for the netherlands and belgium -->
    <!-- translation in english for france -->
    <text>Bon Hello (just an example)</text>


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
<xsl:output method="html" indent="yes"/>
<xsl:param name="country"  select="'nl'" />
<xsl:param name="language" select="'nl'" />
<xsl:template match="//resource">
  <xsl:apply-templates select="translation[language=$language and
<xsl:template match="//translation">
  <xsl:apply-templates select="text"/>

This works :-) Changing the 2 parameters also works :-)
(they are in the future passed to the stylesheet processor, already tested
with MSXML and it worked,
now it are just defaults if nothing is passed)

BUT I don't like the XML syntax...

I want this XML as input and I need an XSLT with the same result as above:
(not that this is also possible: country="be,fr,en,de" and even in some
language="nl,fr,en" or something like that, I would like it if country="be,
nl, fr"
would be possible...)


<resource name="hello">
  <translation language="fr" country="be,fr">Bonjour</translation>
  <translation language="nl" country="be">Goedendag</translation>
  <translation language="nl" country="nl">Hallo</translation>
  <translation language="en" country="nl, be">Hello</translation>
  <translation language="en" country="fr">Bon Hello (just an



Can anybody help me out?

Thanks in advance,

Rogier Hofboer

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

Current Thread


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.
First Name
Last Name
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.