This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Changing values of parameters from xml file..
- To: <XSL-List at mulberrytech dot com>
- Subject: Changing values of parameters from xml file..
- From: "Grettir Einarsson" <grettir at kogun dot is>
- Date: Mon, 19 Jun 2000 16:38:01 -0000
- Reply-To: xsl-list at mulberrytech dot com
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="http://www.w3.org/TR/WD-xsl">
<xsl:script>
// Operations to concatenate character in front of the id
<![CDATA[
var ID;
function parentID(number){
ID = "p" + number;
return ID;
}
function childID(number){
ID = "c" + number;
return ID;
}
]]>
</xsl:script>
<xsl:template match ="/" >
<html>
<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;">
<table>
<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
select="Kennitala"/>)">
<xsl:value-of select="Heimili"/>
<xsl:value-of select="Postfang"/>
<xsl:value-of select="Borg"/></div>
</xsl:for-each>
</td>
</table>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The output should be the value in <Nafn></Nafn> and onclick
it should drop down the values in <Heimili></Heimili>
<Postfang></Postfang>
<Borg></Borg>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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"?>
<Results>
<Person>
<Kennitala>1905754629</Kennitala>
<Nafn>Þórarinn Grettir Einarsson </Nafn>
<Heimili>Setbergi 27 </Heimili>
<Postfang>815 </Postfang>
<Borg>Þorlákshöfn </Borg>
</Person>
</Results>
______________________________________________________
Þórarinn Grettir Einarsson mailto:grettir@kogun.is
mailto:grettir@mmedia.is
Forritari, Programmer
gsm: +354-698-7579
http://www.mmedia.is/~grettir
Kögun Ltd. tel: +354-580-9200
Lynghálsi 9 fax: +354-580-9266
IS-110 Reykjavík http://www.kogun.is
Iceland
______________________________________________________
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list