[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Embedded bold,italic,anchors etc.


Subject: Re: [xsl] Embedded bold,italic,anchors etc.
From: "CyberSpace Industries 2000 Inc." <csi2000@xxxxxxxxxxxxxxx>
Date: Wed, 11 Jun 2008 08:13:25 -0400

Although you didn't show us what you are doing, I suspect you are probably doing a xsl:value-of within a template - whereas you should be doing an xsl:apply-templates to handle the embedded elements.

The value-of will return the concatentated values of all descendent text nodes.
The apply-templates will continue applying templates to all child nodes. Hence if you have a template matching on "bold" e.g.


<xsl:template match="bold"> <!-- assuming your source file uses bold for bolding -->
<b><xsl:apply-templates /></b> <!-- convert to equivalent html bold -->
</xsl:template>


It would be triggered and give you what you want. Similarly for italic, anchors, etc. Note that I did an apply-templates here to allow bolded text to recursively contain italic and/or anchors.

Cheers...Hugh
CyberSpace Industries 2000 Inc.
Multimedia Promotion
XML Training and Consulting
http://cyberspace-industries-2000.com



----- Original Message ----- From: "Craig Riley" <craig@xxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, June 11, 2008 7:33 AM
Subject: [xsl] Embedded bold,italic,anchors etc.



Hi,

I'm fairly new to XSLT so please be nice! :)

I have created an XSLT style sheet that does everything I need it to
except for handling embedded text. The XML documents I am transforming
contain the usual italic, bold, superscript, plus hyper links that
need converting into html.

Of course I need them to retain there place in the copy of course.
I've searched online and inside books but can't find a solution to
this problem.

Please help!


Cheers


Craig




---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.



--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG.
Version: 8.0.100 / Virus Database: 270.2.0/1495 - Release Date: 6/10/2008 5:11 PM



Current Thread
Keywords