I have a problem writing my XSL. I have a link with the following code:
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat($myUrl,'&projectNumber=',$projectNumber)"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="title"/>
</xsl:attribute>
LINK
</a>
So I need to pass a variable projectNumber
to the end of myUrl
. This works just fine and I get ...myUrl...&projectNumber=...projectNumber...
in HTML.
The problem is, that the variable projectNumber
sometimes has some characters which have to be escaped in the href of my link. I tried using the XSL function str:escape-uri()
in many different ways, but still no success...
For example if myUrl is www.example.com/example.aspx?a=b
and projectNumber is aaaūaaa
I get href like www.example.com/example.aspx?a=b&projectNumber=aaaūaaa
, but I need to get www.example.com/example.aspx?a=b&projectNumber=aaa%C5%ABaaa
. (%C5%AB
is the way that 'ū' is escaped) Any suggestions? Thanks.
If you are using XSLT 1.0, then refer this.
In case of XSLT 2.0, you may use this to solve the issue.
<xsl:value-of select="concat($myUrl,'&projectNumber=',encode-for-uri($projectNumber))"/>