Re: [xsl] Outputting dynamically

Subject: Re: [xsl] Outputting dynamically
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 6 Nov 2002 15:09:32 GMT
Your desription isn't very clear...


> I want to ouput only these
> attributes being passed.
> Any suggestions, 

You can't _just_ output attributes, do you mean that you want
an identity transform, but just don't copy attributes not in the
supplied list so in your example the output would be 

<customer>
  <order>
     <orderdet>
       <item itemid="145" desc="hammer"/>
       <item itemid="145" desc="nails"/>
     </orderdet>
  </order>
</customer>

as itemid and desc attributes get copied but id and qty do not?

if so take the identity transform example from the xslt spec and add
the template

<xsl:template match="@*" priority="10">
 <xsl:if test="contains(concat('|',$attr,'|'),concat('|',name(),'|'))">
  <xsl:copy-of select="."/>
 </xsl:if>
</xsl:template>

then your 

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


should work.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

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


Current Thread