Changing values of parameters from xml file..

Subject: Changing values of parameters from xml file..
From: "Grettir Einarsson" <grettir@xxxxxxxx>
Date: Mon, 19 Jun 2000 16:38:01 -0000
Hi all.  I´m trying to get values from a xml document and put it as a ID in
a xsl document which is meant to transform the xml document to html.  The
problem is I don´t know how to get the value from the xml document and
concatenate it with a string ( one character )...

Here is the xsl coding (I´ve cut out some irrelevant lines to save space)

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="";>
	// Operations to concatenate character in front of the id
 	   var ID;
	   function parentID(number){
	      ID = "p" + number;
	      return ID;
         function childID(number){
            ID = "c" + number;
            return ID;

   <xsl:template match ="/" >
         <body style="font-family: verdana; font-size: 7pt">

         <div id="menu" style="position: absolute; width: 300px; height:
200px; z-index: 11; visibility: visable; cursor: hand;">
            <td bgcolor="#ACF0FF" width="100%">
               <xsl:for-each select="Results/Person">

                //Here I was trying to get the id
                //stated in the xml file under <Kennitala></Kennitala>
                //The first id is supposed to have a "p" in front of it (for
parent) and
                //the second id is suppose to have a "c" (for child).
                //I´ve been trying to submit the value to a variable, but
I´m not
                //familiar to the syntax of how it should be done

                 <a class="Level1"  id="$parentID(<xsl:value-of
select="Kennitala"/>)"><xsl:value-of select="Nafn"/></a>
                  <div style="display:none" id="$childID(<xsl:value-of
                     <xsl:value-of select="Heimili"/>
                     <xsl:value-of select="Postfang"/>
                     <xsl:value-of select="Borg"/></div>


The output should be the value in <Nafn></Nafn> and onclick
it should drop down the values in <Heimili></Heimili>

Here is an example of the data in the xml file

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
		<Nafn>Þórarinn Grettir Einarsson </Nafn>
		<Heimili>Setbergi 27 </Heimili>
		<Postfang>815 </Postfang>
		<Borg>Þorlákshöfn </Borg>

Þórarinn Grettir Einarsson	mailto:grettir@xxxxxxxx
Forritari, Programmer
gsm: +354-698-7579

Kögun Ltd.			tel: +354-580-9200
Lynghálsi 9			fax: +354-580-9266
IS-110 Reykjavík

 XSL-List info and archive:

Current Thread