Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XSLT axis navigation

Reply
Thread Tools

XSLT axis navigation

 
 
A Amitkashaw
Guest
Posts: n/a
 
      11-18-2003
Hi Everyone.

I'm having a few problems with the following XSL statement -

<xsl:template match="htm:div[text()='Fred's List of Things:']">
<xsl:for-each
select="../following-sibling::*/child::htm:i[text()='Guitars:']">
<xsl:value-of select="text()"/>
</xsl:for-each>
</xsl:template>

It returns the ELEMENT 'Guitars:' but what I need is the text after it. I'm
stumped if I can figure out how to get this value to return. The reason why
I'm using the above XML is because there are lots of other <i> ELEMENTS
within the document with the text 'Guitars:' and I need Fred's guitar choice
specifically.

Here's the XML:

- <td>
<div align="right">Fred's List of Things:</div>
</td>

<td>
<i>Hobbys:<i>
Reading, Writing, painting, riding bikes
<br />
<i>Books I have read:</i>
Animal Farm,
<br />
<i>Guitars:</i>
1 Gibson Les Paul
<br />
<i>Cars:</i>
None, I like riding my bike everywhere
<br/>
</td>

Thanks for your time in this matter.

- S


 
Reply With Quote
 
 
 
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      11-18-2003
In article <qtqub.2596$(E-Mail Removed)>,
A Amitkashaw <(E-Mail Removed)> wrote:

% select="../following-sibling::*/child::htm:i[text()='Guitars:']">

% It returns the ELEMENT 'Guitars:' but what I need is the text after it.

where the element in question is like this

% <i>Guitars:</i>
% 1 Gibson Les Paul
% <br />

you could try appending

/../following-sibling::/text()[1]

to your expression. That should get everything up to the <br/>.
--

Patrick TJ McPhee
East York Canada
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Skaffen Amitkashaw
Guest
Posts: n/a
 
      11-18-2003
Thanks, Patrick.

How good are you with the number() function? I'm trying to return mixed
numbers and string. For example: 45 km. Do I need to strip out the 'km'
or does the number function take care of this for me?

Thanks again for your time

- S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Marrow
Guest
Posts: n/a
 
      11-19-2003
Hi,

The following expression will remove any non-numeric characters from, for
example, the context node...

translate(.,translate(.,'0123456789',''),'')

Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



"Skaffen Amitkashaw" <(E-Mail Removed)> wrote in message
news:3fba780f$0$200$(E-Mail Removed)...
> Thanks, Patrick.
>
> How good are you with the number() function? I'm trying to return mixed
> numbers and string. For example: 45 km. Do I need to strip out the 'km'
> or does the number function take care of this for me?
>
> Thanks again for your time
>
> - S
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Skaffen Amitkashaw
Guest
Posts: n/a
 
      11-19-2003
Hello Marrow,

Thanks ever so much!

-S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Axis question: what is the correct way to use Axis? ed Java 2 12-08-2006 07:31 PM
Calling a Web Service using Axis, from within an Axis Web Service running under Tomcat hocho888 Java 1 04-29-2005 08:26 PM
AXIS jars org.apache.axis.wsi.* and org.apache.axis.transport.jms.* unkwb@web.de Java 0 02-23-2005 04:02 PM
Axis 1.1 don't delete attachments in the axis attachment cache Stefan Java 0 05-06-2004 08:00 PM
axis.jar does not contain org.apache.axis.client.ServiceClient? Joey Vendetta Java 0 04-01-2004 05:51 PM



Advertisments