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

Re: Selecting specific portions of a tree.

Subject: Re: Selecting specific portions of a tree.
From: Mukul Gandhi <mukulgw3@xxxxxxxxx>
Date: Tue, 9 Dec 2003 07:26:11 -0800 (PST)
xsl child tree
Hi Paul,
  I have written the following XSL, to illustrate the
concept.. I guess, you wish to access the 11th node ;)

XSL
---
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0"
encoding="UTF-8" indent="yes"/>
	
<xsl:template match="root">
  <xsl:for-each select="child">
    <xsl:if test="position() = 11">
	<xsl:call-template name="print11thNode">
	  <xsl:with-param name="x" select="."/>
	</xsl:call-template>
    </xsl:if>
  </xsl:for-each>
</xsl:template>
	
<xsl:template name="print11thNode">
  <xsl:param name="x"/>
  <xsl:value-of select="$x"/>
</xsl:template>

</xsl:stylesheet>

The XML, I have assumed is --
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <child>1</child>
  <child>2</child>
  <child>3</child>
  <child>4</child>
  <child>5</child>
  <child>6</child>
  <child>7</child>
  <child>8</child>
  <child>9</child>
  <child>10</child>
  <child>11</child>
  <child>12</child>
  <child>13</child>
  <child>14</child>
  <child>15</child>
</root>

I have added the numbers 1,2,3 etc, within child tags,
for illustration purpose ;)

I hope, my answer is useful ;)

Regards,
Mukul

--- Paul Barclay <paul.barclay@xxxxxxxxxxxxxxxxxx>
wrote:
> Given the XML.
> 
> <root>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> 	<child ..../>
> </root>
> 
> what is the XSL expression to select the 3rd to the
> 8th child of root?
> 
> Thanks
> Paul
> 
> 
>
________________________________________________________________________
> 
> E-mail is an informal method of communication and
> may be subject to data corruption, interception and
> unauthorised amendment for which Digital Bridges Ltd
> will accept no liability. Therefore, it will
> normally be inappropriate to rely on information
> contained on e-mail without obtaining written
> confirmation.
> 
> This e-mail may contain confidential and/or
> privileged information. If you are not the intended
> recipient (or have received this e-mail in error)
> please notify the sender immediately and destroy
> this e-mail. Any unauthorized copying, disclosure or
> distribution of the material in this e-mail is
> strictly forbidden.
> 
>
________________________________________________________________________
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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