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

RE: Conditional extraction of data

Subject: RE: Conditional extraction of data
From: "Bradley, Peter" <PBradley@xxxxxxxxxx>
Date: Mon, 8 Nov 2004 15:21:58 -0000
careless words cost lives
Don't mention the T-word on XSL-list:-)

XSLT does not have access to the tags in your source document and can
not directly generate tags in the result. XSLT just works on trees of
nodes. An XML parser (may) be used to get an input tree from the tags in
a document and the result tree (may) be serialised to a text file as
text containing tags.

I stand corrected - and I take the point.  "Careless words cost lives" as we
used to say in a world I remember, but almost all of you won't.

:)

Cheers

Peter

-----Original Message-----
From: 	David Carlisle [mailto:davidc@xxxxxxxxx]
Sent:	08 November 2004 15:16
To:	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:	Re:  Conditional extraction of data



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

this is just a simple case of the more general transform where you want
to change everything.
In your case you want to transform most elements by junking the element
node and taking its string value

<xsl:template match="anElement/*">
 <xsl:value-of select="."/>
</xsl:template>

then you want to do something different for b so


<xsl:template match="anElement/b" priority="2">
 <i><xsl:value-of select="."/></i>
</xsl:template>



again if you need to recursively apply processing to child elements
you may need to replace xsl:value-of by apply-templates.


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

Don't mention the T-word on XSL-list:-)

XSLT does not have access to the tags in your source document and can
not directly generate tags in the result. XSLT just works on trees of
nodes. An XML parser (may) be used to get an input tree from the tags in
a document and the result tree (may) be serialised to a text file as
text containing tags.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread

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.