[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: selecting a subtree from a tree
hi..
if u wana store the record where namedcell name = client, then you have to declare variable in the following way <xsl:variable name="client" select="//root/record/namedcell[@name='client']> same is the case with address. ie.<xsl:variable name="client" select="//root/record/namedcell[@name='client']> This would store the value of the namedcell, where the name = 'client' or 'address'. Now if you wana further know what the data is then, you have to reach its sibling whose name is data. remember there may be other siblings as well for the namedcell so you have to refer to that element with the name of the sibling. The following xsl code will get you the data associated with the namedcell where name = 'client' and name = 'address' <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:variable name="client" select="//record/namedcell[@name='client']/following-sibling::data"/> <xsl:variable name="address" select="//record/namedcell[@name='address']/following-sibling::data"/> Client : <xsl:value-of select="$client"/> <br></br> Address : <xsl:value-of select="$address"/> </xsl:template> </xsl:stylesheet> This would produce a result Client client x Address xmlstreet 15 when viewed as a HTML output.. Hope This Helps laura From: "Joeri Belis" <joeri.belis@xxxxxxxxxxxx> Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Subject: selecting a subtree from a tree Date: Fri, 5 Apr 2002 14:34:51 +0200 _________________________________________________________________ Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|