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

[xsl] (SOLVED) Re: [xsl] xsl != not working?


Subject: [xsl] (SOLVED) Re: [xsl] xsl != not working?
From: Joe Stump <joe@xxxxxxxxxxxx>
Date: Tue, 21 Jun 2005 10:59:50 -0700

Doing:

<xsl:if test="normalize-space(//h2[1]/text()) != normalize-space(text ())">

Fixed it. Quite annoying ...

--Joe

On Jun 21, 2005, at 10:56 AM, Joe Stump wrote:

I've got a bunch of h2's in a document that I want to group at the top with jumps to the actual h2's in the body, which I have working without incident. The problem I have is with links back to the top. Basically, if it's NOT the first h2, it should show a "Back to Top" link above the h2. I have a test that appears to be exactly what I need, but it's not working. The basic test is:

//h2[1]/text() != text()

Below is the full XSLT (it's in a template matching h2's).

    <xsl:if test="//h2[1]/text() != text()">
          <xsl:text>"</xsl:text>
          <xsl:value-of select="//h2[1]/text()"/>
          <xsl:text>"</xsl:text>
          <xsl:text> != </xsl:text>
          <xsl:text>"</xsl:text>
          <xsl:value-of select="text()"/>
          <xsl:text>"</xsl:text>

      <xsl:element name="div">
          <xsl:attribute name="class">article-top</xsl:attribute>
          <xsl:element name="a">
            <xsl:attribute name="class">article-top</xsl:attribute>
            <xsl:attribute name="href">#top</xsl:attribute>
            <xsl:text>Back to Top</xsl:text>
          </xsl:element>
      </xsl:element>
    </xsl:if>

Here's my output for my first h2 (which should NOT have a link to top above it):

"Definition" != "Definition"
Back to Top

Quite annoying ... any ideas? How can 'Definition' not equal 'Definition'?

--Joe


Current Thread
Keywords