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

RE: XSLQUERRY

Subject: RE: XSLQUERRY
From: Jeff Beadle <Jbeadle@xxxxxxxx>
Date: Wed, 27 Feb 2002 08:01:28 -0500
jeffrey beadle child support
First of all, be advised that the definition of your /*//schedule[2]/@type
attribute has a leading whitespace.  I removed the whitespace from the 
examples below.

There are several ways to tackle this, here's a few:

  1.  When you use "xsl:value-of" against an element you'll get 
      all of the given element's text nodes.  In your case, it'll
      be just one.

         <!-- anywhere within your xslt doc -->
         <xsl:value-of select="/*//schedule[@category='title' 
                                    	  and
      						  @type='title1']"/>
	
  2.  You could be explicit, and grab the child text nodes directly:

         <!-- anywhere within your xslt doc -->
         <xsl:value-of select="/*//schedule[@category='title' 
							  and 
	
@type='title1']/text()"/>
	

         Note:  that the text() xpath function will bring back all the text
				 node children of the given element ... so
it's a nodeset.
				 But, since you're only interested in the
first one (and the 
				 only one) your safe.
				 
  3.  Or you could be rigidly explicit, and grab the first text() 
      node directly.  This would be the safest, but in your case, assuming 
      that the schema of the source document is well represented by the
example
      you gave, it's probably unnecessary.

         <!-- anywhere within your xslt doc -->
         <xsl:value-of select="/*//schedule[@category='title' 
							  and 
	
@type='title1']/text()[1]"/>

	


HTH,
Jeff


-----Original Message-----
From: XSL Developer [mailto:vsd18@xxxxxxxxxxxxxx]
Sent: Wednesday, February 27, 2002 6:47 AM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject:  XSLQUERRY



dear xsl members,
i have a problem. here it goes..
xml structure:

<root>
<schedule category="title" type = "title2">
title2
</schedule>
<schedule category="title" type = " title1">
title1
</schedule>
<schedule category="title" type = "title3">
episode
</schedule>
<schedule category="description" type="desc1">
desc1
</schedule>
</root>
and i want to get the text where category = title and type = 
title1

how can i do that??
thanks
vsd


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

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


Current Thread
  • XSLQUERRY
    • XSL Developer - Wed, 27 Feb 2002 06:43:53 -0500 (EST)
      • <Possible follow-ups>
      • Jeff Beadle - Wed, 27 Feb 2002 07:58:32 -0500 (EST) <=

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.