Subject: RE: [xsl] XSLQUERRY From: Jeff Beadle <Jbeadle@xxxxxxxx> Date: Wed, 27 Feb 2002 08:01:28 -0500 |
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: [xsl] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLQUERRY, cutlass | Thread | [xsl] Tables within table., Nitin . Jain |
Re: [xsl] getting the node position, Jeni Tennison | Date | Re: [xsl] String comparisons fail u, cutlass |
Month |