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

XSL String Mapping Problem.

Subject: XSL String Mapping Problem.
From: "Jos van Roosmalen" <jos.v.roosmalen@xxxxxxxxx>
Date: Wed, 10 Dec 2008 11:20:54 +0100
 XSL String Mapping Problem.

I am looking for a very nice mapper  "Design Pattern".

I used the XML/XSL snippet below. However the "@key eq ." seems not to work.

If I introduce a variable it works fine:

    <xsl:variable name="var" select="."/>
    <xsl:value-of select="$map[@key eq $var]/@val"/>


1. How to get this mapper working without variable?
2. What is the the 'defacto XPath standard' for mapping  a list
hardcoded keys to hardcoded values?

Thanks, Jos


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
    <xsl:variable name="map" as="element()+">
      <elem key="key1" val="value1"/>
      <elem key="key2" val="value2"/>
      <elem key="key3" val="value3"/>
<xsl:template match="demos/demo">
    Found key: <xsl:value-of select="."/>
    Corresponding value: <xsl:value-of select="$map[@key eq .]/@val"/>

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.