I'm trying to make a TOC xslt but i dont know much about regular expressions.
On the document type i have 2 fields where i put start and end letter and i would like my xslt to fetch all pages beginning with a letter between start and end? Can this be done?
String Match
I'm trying to make a TOC xslt but i dont know much about regular expressions.
On the document type i have 2 fields where i put start and end letter and i would like my xslt to fetch all pages beginning with a letter between start and end? Can this be done?
<ul>
<xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:if test="Exslt.ExsltRegularExpressions:match(@nodeName, '[a-Z]')">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
I've changed to
<xsl:variable name="startLetter" select="substring(@nodeName,1,1)"/>
Start Letter=<xsl:value-of select="$startLetter"/><br />
<xsl:if test="Exslt.ExsltRegularExpressions:match($startLetter, '[a-D]')">
But the match wont work :/
This one works
<xsl:if test="Exslt.ExsltRegularExpressions:test($startLetter, '[A-Sa-s]')">
One problem more! How do i make the range dynamic?
I have this:
<xsl:variable name="startLetter" select="Exslt.ExsltStrings:uppercase(startBogstav)"/>
<xsl:variable name="endLetter" select="Exslt.ExsltStrings:uppercase(slutBogstav)"/>
<xsl:if test="Exslt.ExsltRegularExpressions:test($firstLetter, '[A-Z]')">
And would like to have
<xsl:if test="Exslt.ExsltRegularExpressions:test($firstLetter, '[$startLetter-$endLetter]')">
But when i do that i get "[x-y] range in reverse order"
Got it working with this
<xsl:variable name="startLetter" select="Exslt.ExsltStrings:uppercase(startBogstav)"/>
<xsl:variable name="endLetter" select="Exslt.ExsltStrings:uppercase(slutBogstav)"/>
<xsl:variable name="reqexp" select="concat('[', $startLetter, '-', $endLetter, ']')"/>
is working on a reply...