Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have url and QueryString like :http://domain/page?categoryId =2560&subcategoey=7777
<xsl:variable name="oldCategory">
categoryId=<xsl:value-of select="$categoryId"/>
</xsl:variable>
<xsl:variable name="newCategory">
categoryId=9999</xsl:variable>
<xsl:variable name="url">
<xsl:value-of select="umbraco.library:Replace($searchUrl, $oldCategory, $newCategory)"/>
but url remains the same.
How can I change url?
Thanks,
kukuwka
What output do you get when you add these to your XSLT?
Search: <xsl:value-of select="$searchUrl"/> <br/> Old: <xsl:value-of select="$oldCategory"/> <br/> New: <xsl:value-of select="$newCategory"/>
I get right values.
Old: categoryId=2560
New :categoryId=9999
And searchUrl, maybe you could post your whole XSLT here?
The replace function certainly does work, so something simple must be wrong.
Rich
Hi kukuwka,
I think the Replace function might not like the value of the $oldCategory and $newCategory variables - probably due to the whitespace/character-data.
Instead of using <xsl:value-of> inside the <xsl:variable> tags - try using the select?
<xsl:variable name="oldCategory" select="concat('categoryId=', $categoryId)" /> <xsl:variable name="newCategory" select="string('categoryId=9999')" /> <xsl:variable name="url" select="umbraco.library:Replace($searchUrl, $oldCategory, $newCategory)" />
Let us know if that works out.
Cheers, Lee.
This is my code:
<xsl:variable name="searchUrl" select="/macro/searchUrl"/><xsl:variable name="categoryId" select="umbraco.library:RequestQueryString('categoryId')"/>
<xsl:for-each select="$items">
categoryId=<xsl:value-of select="@id"/>
<xsl:variable name="url"> < xsl:value-of select="umbraco.library:Replace($searchUrl, $oldCategory, $newCategory)"/>
<a href="{$url}"> <xsl:value-of select="$nodeName"/>
</a>
</xsl:for-each>
Hi Lee,
Thank you very much.
It works.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
umbraco.library:Replace dosn't work
Hi,
I have url and QueryString like :
http://domain/page?categoryId =2560&subcategoey=7777
<xsl:variable name="oldCategory">
categoryId=<xsl:value-of select="$categoryId"/>
</xsl:variable>
<xsl:variable name="newCategory">
categoryId=9999
</xsl:variable>
<xsl:variable name="url">
<xsl:value-of select="umbraco.library:Replace($searchUrl, $oldCategory, $newCategory)"/>
</xsl:variable>
but url remains the same.
How can I change url?
Thanks,
kukuwka
What output do you get when you add these to your XSLT?
I get right values.
Old: categoryId=2560
New :categoryId=9999
And searchUrl, maybe you could post your whole XSLT here?
The replace function certainly does work, so something simple must be wrong.
Rich
Hi kukuwka,
I think the Replace function might not like the value of the $oldCategory and $newCategory variables - probably due to the whitespace/character-data.
Instead of using <xsl:value-of> inside the <xsl:variable> tags - try using the select?
Let us know if that works out.
Cheers, Lee.
This is my code:
<xsl:variable name="searchUrl" select="/macro/searchUrl"/>
<xsl:variable name="categoryId" select="umbraco.library:RequestQueryString('categoryId')"/>
<xsl:variable name="oldCategory">
categoryId=<xsl:value-of select="$categoryId"/>
</xsl:variable>
<xsl:for-each select="$items">
<xsl:variable name="newCategory">
categoryId=<xsl:value-of select="@id"/>
</xsl:variable>
<xsl:variable name="url">
< xsl:value-of select="umbraco.library:Replace($searchUrl, $oldCategory, $newCategory)"/>
</xsl:variable>
<a href="{$url}">
<xsl:value-of select="$nodeName"/>
</a>
</xsl:for-each>
Thanks,
kukuwka
Hi Lee,
Thank you very much.
It works.
is working on a reply...