Subject: Re: [xsl] selecting a subtree from a tree From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> Date: Fri, 05 Apr 2002 10:59:00 -0700 |
<root> <record> <namedcell name="ordernr"/> <data>1</data> </record> <record> <namedcell name="client"/> <data>client x</data> </record> <record> <namedcell name="address"/> <data>xmlstreet 15</data> </record> <record> <namedcell name="country">
<data>Transformatia</data> </record> </root>
how can i select the 2 record of client and address and assign them to a variable. I don't need the first and last record (ordernr and country ) in this nodeset.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8"/> <xsl:template match="/"> <output> <xsl:apply-templates/> </output> </xsl:template> <xsl:template match="root"> <!-- Select all children of "root" that have a child element "namedcell". Furthermore, that element must have an attribute called "name" and the value of the attribute must be either "client" or "address". --> <xsl:variable name="short-list" select="child::*[namedcell/@name='client' or namedcell/@name='address']"/> <xsl:copy-of select="$short-list"/> </xsl:template> </xsl:stylesheet>
<output> <record> <namedcell name="client" /> <data>client x</data> </record> <record> <namedcell name="address" /> <data>xmlstreet 15</data> </record> </output>
Greg Faron Integre Technical Publishing Co.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] selecting a subtree from a tr, Joeri Belis | Thread | Re: [xsl] selecting a subtree from , Laura Jenkins |
Re: [xsl] xsl:if and position, Greg Faron | Date | [xsl] Selecting Parent Nodes with E, Hellstern, Manny |
Month |