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

Re: apply-templates and XHTML's <p> tag

Subject: Re: apply-templates and XHTML's <p> tag
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 24 Mar 2003 19:35:52 +0100
 Re: apply-templates and XHTML's <p> tag
"Gan Uesli Starling" <alias@xxxxxxxxxxx> wrote in message
news:3E7F4784.8030801@xxxxxxxxxxxxxx
>
> But when parsing an XHTML <p> tag, it may
> have text mish-mashed in and between <b> and <i>
> and <span> tags...in no fixed order.
>
> I will lose all the style stuff if I just do...
>
> <xsl:template match="p">
>    <xsl:value-of select="."/>
> </xsl:template>
>
> ...as the <b>, <i> and <span> will go bye-bye with
> all their text siphoned out from them, yes? I don't
> want that, obviously.
>
> Cool would be to split <p> into a sequence of <foo>
> tags with the <b> and <i> as attributes for some,
> not on others.
>
> Can someone point me at a tutorial or how-to which
> illustrates an XSLT-ish method for dealing sequentially
> with a mixed bunch of text and tags?


First of all, XSLT deals not with "tags" but with nodes.

It is not clear exactly what you want -- probably you need to copy the
descendents of "p". Your problem is that using

    <xsl:value-of select="."/>

copies not nodes but the string value of the current node.

To copy all nodes that are children of the current node use:

<xsl:copy-of select="node()"/>



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.