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

Re: How to pick and choose nodes to get value

Subject: Re: How to pick and choose nodes to get value
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 4 Jan 2002 16:51:09 +0000
get elements nodes by value
Hi Khalid,

> in the above code what I want to do is to get all the nodes
> excluding system-id and last-modified one'e. and I want to get value
> of rest of the nodes one by one,Unlike, I have used select = "."
> code, which returns a long string with all the values in it. I want
> to get value of each node at a time not explicitly knowing that what
> node I am getting value for .except the system id and last modified
> nodes?

To explicitly know what kind of node you're dealing with each time
(presumably so that you can treat them differently), I'd use templates
that match each kind of node. So you'd have one template for

<xsl:template match="trading-name">

One template for number-and-street-name:

<xsl:template match="number-and-street-name">

and so on for the rest of the elements that you're interested in.

To ignore the system-id and last-modified elements, you have two
choices. First, within the template for the address element (or
wherever you're processing the address element, if it's not in its own
template), you could apply templates to only the elements that you're
interested in:

<xsl:template match="address">
    select="*[not(self::system-id or self::last-modified)]" />

Second, you could apply templates to all the child elements:

<xsl:template match="address">
  <xsl:apply-templates select="*" />

and then have a template that matches the elements that you want to
ignore and does nothing with them:

<xsl:template match="system-id | last-modified" />



Jeni Tennison

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

Current Thread


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.
First Name
Last Name
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.