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

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
kennitala
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@xxxxxxxx
				      mailto:grettir@xxxxxxxxx
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


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.