xsl:text element?

Mike Kamermans

Usenet Archive
Joined
Aug 10, 2004
Messages
14
Reaction score
0
I'm having difficulty XSL tranforming some XML of the form <some_element> <jis>1234</jis></some_element> into the xhtml form <img src="jis/1234.gif"/>

My initial idea was to use the following XSL:

<xsl:text><img src="jis/</xsl:text><xsl:value-of select"./jis/text"/> <xsl:text>.gif"/></xsl:text>

But when I run this, I get the error that "src may not contain a < symbol" (I run this in the XSLT engine that comes with the Exchanger XML editor v2, which uses Xerces 2.6.2 and Saxon 6.5.2). I must admit being slightly confused... am I using <xsl:text> wrong, or should this work for all intents and purposes?

Mike Kamermans
 

Joris Gillis

Usenet Archive
Joined
Sep 28, 2004
Messages
355
Reaction score
0
Hi,

use:
<img src="jis/{./jis/text}.gif"/>
or:
<img>
<xsl:attribute name="src">jis/<xsl:value-of
select="./jis/text"/>.gif</xsl:attribute>
</img>

regards,
 

David Carlisle

Usenet Archive
Joined
Jan 5, 2000
Messages
609
Reaction score
0
My initial idea was to use the following XSL:

<xsl:text><img src="jis/</xsl:text><xsl:value-of
select"./jis/text"/>

XSLT has to be well formed XML, you can never have element markup inside an attribute in XML so that would be rejected by the XML parser before XSLT started.

if you fix the attribute so that XSLt does see the file, the XSLT engine will tell you that you can't have result elements inside xsl:text (only text)

Use

<img src="jis/{jis}.gif"/>

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top