xsl-list
[Top] [All Lists]

Re: Outputting dynamically

2002-11-06 08:22:45
Hi Juan,
With your > <xsl:param name="attr" select"'itemid|desc'"/>,
i assume that you want to select the attributes itemid "or" desc.
 In which case, for the following code, you would get an output:
145
hammer
145
nails

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:param name="node-names" select="'itemid|desc'"/>
<xsl:template match="/">
<xsl:variable name="attr1" select="substring-before($node-names,'|')"/>
<xsl:variable name="attr2" select="substring-after($node-names,'|')"/>
<xsl:for-each select="//@*[name() = $attr1 or name() = $attr2]">
<xsl:value-of select="."/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

HTH
Vasu
----- Original Message -----
From: "Juan Carlos Gonzalez" <jcgonz(_at_)yahoo(_dot_)com>
To: <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, November 06, 2002 2:35 PM
Subject: [xsl] Outputting dynamically


Hi:

I want to pass the node attributes name as an
parameter to the XSLT file to transform a XML file.
For example:

<customer id="1">
  <order id="122" >
     <orderdet date="12/12/02">
       <item itemid="145" desc="hammer" qty="2"/>
       <item itemid="145" desc="nails" qty="6"/>
     </orderdet>
  </order>
</customer>

Then I would have in the XSLT file something like or
if someone can come with a better idea:

<xsl:param name="attr" select"'itemid|desc'"/>

and based on that I want to ouput only these
attributes being passed.
Any suggestions,
thanks.

__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

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


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



<Prev in Thread] Current Thread [Next in Thread>