Sign In | Register Now About Bytes | Help | Site Map
Connecting Tech Pros Worldwide

XML to XHTML using XSL - Getting Element text

Question posted by: KDawg44 (Guest) on June 27th, 2008 07:07 PM
Hi,

How can I use XSL to get to the text within an element?

For example, say I have the following XML:

<sunday>
<am>Leisure Day</am>
<pm>3:00 Tigers Game</pm>
</sunday>

how can I extract the word sunday?

Thanks

Kevin
Bjoern Hoehrmann's Avatar
Bjoern Hoehrmann
Guest
n/a Posts
June 27th, 2008
07:07 PM
#2

Re: XML to XHTML using XSL - Getting Element text
* KDawg44 wrote in comp.text.xml:
Quote:
>How can I use XSL to get to the text within an element?
>
>For example, say I have the following XML:
>
<sunday>
> <am>Leisure Day</am>
> <pm>3:00 Tigers Game</pm>
> </sunday>
>
>how can I extract the word sunday?


That's the element (type) name, check out the local-name(), name(), and
namespace-uri() functions in the spec, <http://www.w3.org/TR/xpath>.
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/

KDawg44's Avatar
KDawg44
Guest
n/a Posts
June 27th, 2008
07:07 PM
#3

Re: XML to XHTML using XSL - Getting Element text
On Jun 11, 7:25*pm, Bjoern Hoehrmann <bjo...@hoehrmann.dewrote:
Quote:
* KDawg44 wrote in comp.text.xml:
>
Quote:
How can I use XSL to get to the text within an element?

>
Quote:
For example, say I have the following XML:

>
Quote:
* * * <sunday>
* * * * * *<am>Leisure Day</am>
* * * * * *<pm>3:00 Tigers Game</pm>
* *</sunday>

>
Quote:
how can I extract the word sunday?

>
That's the element (type) name, check out the local-name(), name(), and
namespace-uri() functions in the spec, <http://www.w3.org/TR/xpath>.
--
Björn Höhrmann · mailto:bjo...@hoehrmann.de ·http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 ·http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 ·http://www.websitedev.de/


Thanks. name() did what i needed it to

Thanks!

Kevin

 
Not the answer you were looking for? Post your question . . .
189,075 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors