[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
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 trading-name: <xsl:template match="trading-name"> ... </xsl:template> One template for number-and-street-name: <xsl:template match="number-and-street-name"> ... </xsl:template> 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"> <xsl:apply-templates select="*[not(self::system-id or self::last-modified)]" /> </xsl:template> Second, you could apply templates to all the child elements: <xsl:template match="address"> <xsl:apply-templates select="*" /> </xsl:template> 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" /> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.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
|