If all you want is output from $currentPage, then you don't need to use a for-each - when you're inside a for-each, all your XPaths are in the context of the current node of the loop, so when you say "pageheader" that will take the header from the page currently in the loop - you can always start your XPaths with $currentPage to pick something from the current page being *rendered*, though.
xslt dispaly all the header
here is my code of xslt thet i want to see only current page header but this xslt display all the header so how can i solve this?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- start writing XSLT -->
<xsl:for-each select="$currentPage/SEGWTextPage">
<xsl:choose>
<xsl:when test="pageheaderLink != ''">
<a >
<xsl:attribute name="class">
<xsl:text></xsl:text>
</xsl:attribute>
<xsl:attribute name="href">
<xsl:value-of select="pageheaderLink"/>
</xsl:attribute><h2 style="text-align:left;"><strong style=""></strong> <xsl:value-of select="pageheader"/></h2>
</a>
</xsl:when>
<xsl:otherwise>
<h2 style="text-align:left;"><strong style=""></strong><xsl:value-of select="pageheader"/></h2>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Hi shine,
If all you want is output from $currentPage, then you don't need to use a for-each - when you're inside a for-each, all your XPaths are in the context of the current node of the loop, so when you say "pageheader" that will take the header from the page currently in the loop - you can always start your XPaths with $currentPage to pick something from the current page being *rendered*, though.
I suggest you try this:
/Chriztian
Thank you very much Chriztian its work fine....................
is working on a reply...