xsl-list
[Top] [All Lists]

RE: Conditional extraction of data

2004-11-08 08:17:39

-- 
Bryan Rasmussen
the example(s) I gave you earlier should do this, there may be whitespace
stripping however. 

Quoting "Bradley, Peter" <PBradley(_at_)uwic(_dot_)ac(_dot_)uk>:

Oh, but what if we have:

<anElement>
      Some text <a>that means</a> absolutely <b>nothing</b> at all <a>to
anyone</a> in <c>the world</c>
</anElement>

The output I want is:

Some text that means absolutely <i>nothing</i> at all to anyone in the
world

In other words I want all the text, but convert (in this example) all the <b>
tags to html <i> tags.

Bummer

Peter

 -----Original Message-----
From:         Bradley, Peter  
Sent: 08 November 2004 14:53
To:   xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:      RE: [xsl] Conditional extraction of data

Aha!!

Peter

 -----Original Message-----
From:         Huditsch Roman 
[mailto:Roman(_dot_)Huditsch(_at_)lexisnexis(_dot_)at] 
Sent: 08 November 2004 14:52
To:   xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:      AW: [xsl] Conditional extraction of data

Hi Peter,

You can output the text of an element via <xsl:value-of select="text()"/>,
since an elements text is held in an own text node.

So according to the given example 
<xsl:value-of select="foo"/>
should just output "this is the value of foo" 


Hope this helps.

Good luck for your exercises!

Wbr,
Roman


-----Ursprüngliche Nachricht-----
Von: Bradley, Peter [mailto:PBradley(_at_)uwic(_dot_)ac(_dot_)uk] 
Gesendet: Montag, 8. November 2004 15:45
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: RE: [xsl] Conditional extraction of data

Yeah.  This neatly sums up the problems I've been having.  An XPath
expression always seems to return an entire sub-tree, and it seems to me that
I just want a single node in this case.  Will xsl-copy give me that?

Peter

 -----Original Message-----
From:         Geert Josten [mailto:Geert(_dot_)Josten(_at_)daidalos(_dot_)nl] 
Sent: 08 November 2004 14:42
To:   xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:      Re: [xsl] Conditional extraction of data

M. David Peterson wrote:

ooops!

This portion:

<xsl:value-of select="foo"/> will output: "this is the value of foo"

<xsl:value-of select="foo"/> will output a copy of all the text elements 
as well as the elements and there values that are descendants of foo. o

should have read...

<xsl:value-of select="foo"/> will output: "this is the value of foo"

Not true. xsl:value-of takes the first element from the node-set that results
from the expression 
"foo" and converts that to a string. As both sub elements <bar> and <p> are
_inside_ element <foo>, 
their textual content is returned as well.

The output is therefore: "
    this is the value of foo
    this is the value of bar.this is the value of a paragraph that is the
child of bar
"

(including new-lines when white-space is preserved)

<xsl:copy-of select="foo"/> will output a copy of all the text elements >
as well as the elements and there values that are descendants of foo.

Sorry for the confusion!

<M:D/>

Grtz,
Geert

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--




--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--






<Prev in Thread] Current Thread [Next in Thread>