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

RE: Reference to a other xml or xsl in the main xsl sh

Subject: RE: Reference to a other xml or xsl in the main xsl sheet
From: Jarno.Elovirta@xxxxxxxxx
Date: Fri, 12 Sep 2003 10:14:53 +0300
xml reference other file
Hi,

> I'm using a xsl-stylesheet to do a transformation from one 
> xml-file  to
> another. Within these transformation I need to do a 
> replacement, where for
> example I need to replace the node-text "Holland"
> (<Country>Holland</Country>) for the country-code "HO". 
> Therefore I'm using
> the <xsl:if...> statement. I do have this <xls:if...> 
> statement in multiple
> xls-files.
> What I do want is one generic file (xml/xls) where I do have 
> standing all of
> my replacements standing. Within the xsl-file I do need a 
> reference to this
> "replacements-"file. This way, I only have to change one file if a new
> country has to be added to the list.

Create a mapping file such as

  <map>
    <item key="Holland" value="HO"/>
    ...
  </map>

and in your stylesheet

  <xsl:variable name="map" select="document('themappingfileabove.xml')/map/item"
  <xsl:template match="Country">
    <xsl:value-of select="$map[@key = current()]/@value"/>
  </xsl:template>

Cheers,

Jarno - E-Craft: Violent Freaks

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


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.