xsl:text element?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Kamermans

    #1

    xsl:text element?

    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><im g src="jis/</xsl:text><xsl:v alue-of select"./jis/text()"/>
    <xsl:text>.gi f"/></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

    #2
    Re: xsl:text element?

    Hi,

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

    regards,
    --
    Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
    Ceterum censeo XML omnibus esse utendum

    Comment

    • David Carlisle

      #3
      Re: xsl:text element?


      My initial idea was to use the following XSL:

      <xsl:text><im g src="jis/</xsl:text><xsl:v alue-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

      Comment

      Working...