1

This "$PAGE_SCOPE[title]" will display the title of the page i want to display different headlines based on the title so i am trying to get the page title in a variable, this variable is displaying the title in the paragraph tag but it's not working in the when loop.

<xsl:variable name="PageTitle" select="'$PAGE_SCOPE[title]'" />
<xsl:variable name="test"><xsl:value-of select="$PageTitle" /></xsl:variable>
<p><xsl:value-of select="$test" /></p>

<xsl:choose>
<xsl:when test="$test='RAQ'">
    <h1 class="h3"><strong>.....</strong></h1>
</xsl:when>

<xsl:otherwise>
    <h1 class="h3"><strong>Error</strong></h1>
</xsl:otherwise>
</xsl:choose>

any pointers would be helpful.

  • Ah, try removing the single quotes from the first variable select, as your variables contain `'RAQ'` and not `RAQ` – freefaller Jan 04 '14 at 10:49
  • Are you definitely showing us the right XSLT. You have apostophes in the variable declaration. It should be ``. I only question this because with the apostrophes present the paragraph tag would not show the correct value either. – Tim C Jan 04 '14 at 10:49
  • "$PAGE_SCOPE[title]" this is a predefined variable i am not declaring this.if i remove single quotes around $PAGE_SCOPE[title] in the first variable select i am not able to save the code that's why i gave single quotes i am using this code in Teamsite it's a WCM tool. – user2962780 Jan 04 '14 at 23:29

1 Answers1

0

Assuming that $PAGE_SCOPE[title] works and does what it's supposed to normally (the quote marks above are kind of strange), is this actually returning an element? If it's returning a string value, then this should be working, but if the value of your variable is actually a node, then this would likely explain your issue.

Try using string($test) for your comparison instead. Also, you might consider adding a normalize-space() just to make sure you don't have any white space that's shown up unexpectedly.

lesthaeghet
  • 116
  • 6