How to represent '&' as a variable in xslt file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ofuuzo1@yahoo.no

    How to represent '&' as a variable in xslt file

    Hi,

    I have tried the following but it do not work:

    <xsl:variable name="path1" select="string( '&')"/>
    <xsl:variable name="path1" select="string( '&#38;')"/>
    <xsl:variable name="path1" select="&"/>

    Thanks in advance
    Ofuuzo

  • Martin Honnen

    #2
    Re: How to represent '&amp;' as a variable in xslt file

    ofuuzo1@yahoo.n o wrote:
    I have tried the following but it do not work:
    >
    <xsl:variable name="path1" select="string( '&')"/>
    <xsl:variable name="path1" select="'&amp;' "/>




    --

    Martin Honnen

    Comment

    • Joseph J. Kesselman

      #3
      Re: How to represent '&amp;' as a variable in xslt file

      Martin Honnen wrote:
      <xsl:variable name="path1" select="'&amp;' "/>
      That should be equivalent to select="'&#38;' ", of course.

      (The trick here is the double-quoting. Select is interpreted as an
      XPath... and the XPath syntax wants its own layer of quotes to indicate
      that you're trying to express a literal value.)

      Comment

      • Richard Tobin

        #4
        Re: How to represent '&amp;' as a variable in xslt file

        In article <a3f5c68f-27a1-46d7-a800-31b4e1da07c1@d1 g2000hsg.google groups.com>,
        <ofuuzo1@yahoo. nowrote:
        ><xsl:variabl e name="path1" select="string( '&')"/>
        ><xsl:variabl e name="path1" select="&"/>
        Those won't work because they're not well-formed XML.
        ><xsl:variabl e name="path1" select="string( '&#38;')"/>
        That should work: what error do you get?

        The simplest solution is

        <xsl:variable name="path1" select="'&#38;' "/>

        -- Richard
        --
        :wq

        Comment

        Working...