1<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 2<!-- filename: test.xsl created on: 2001 Jun 14 01:35:21 +0200 (CEST) last modified: 2001 Jun 14 01:47:18 +0200 (CEST) (c) 2001 by Goetz Bock <bock@blacknet.de> 3--> 4<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 5 xmlns:local="data_local_to_this_file" 6 version='1.0'> 7<xsl:output method="text" /> 8<local:benefit> 9<local:period ID='12M'>1</local:period> 10<local:period ID='18M'>2</local:period> 11<local:period ID='24M'>3</local:period> 12<local:period ID='2Y' >4</local:period> 13<local:period ID='5Y' >5</local:period> 14</local:benefit> 15<xsl:template match="/"> 16<xsl:text>First we try to find the value for "12M" (should be 1): </xsl:text> 17<xsl:value-of select="document('')//local:benefit/local:period[@ID='12M']"/> 18<xsl:text>
Now we define a variable $BP to be "18M".</xsl:text> 19<xsl:variable name="BP">18M</xsl:variable> 20<xsl:text>
$BP is defined as: </xsl:text> 21<xsl:value-of select="$BP" /> 22<xsl:text>
Now we try to find the value for $BP (should be 2): </xsl:text> 23<xsl:value-of select="document('')//local:benefit/local:period[@ID=$BP]"/> 24<xsl:text>
</xsl:text> 25</xsl:template> 26</xsl:transform> 27