Would need to extract the text after the single quotes.
E.g.:
<div>('show')</div>
The variables is this:
<xsl:variable name="showName" select="substring-before(substring-after(//x:div, '%28%27'), '%27%29')" />
The result is none, the encoding caracters.
I think it can not be used %28%27 and %27%29. This is correct?.
Thanks.
Techniques
If you are familiar with regular expression you could also use
<xsl:analyze-string>
.Code Sample
Extract content between the single quotes. The content is later referred using
regex-group(1)
) :XSLT 1.0:
Just use:
Here is a complete transformation:
When applied on the provided XML document:
the wanted, correct result is produced:
XSLT 2.0:
In XSLT 2.0 one can use either of the following two approaches:
When this transformation is applied on the same XML document (above), the evaluation of both XPath expressions produces the same result:
Do note:
If you want with a single Xpath expression (making
xsl:analyze-string
unnecessary) to extract/process all substrings surrounded by quotes (where there is unlimited possible number of such substrings), see this answer:https://stackoverflow.com/a/15402185/36305
Finally, using
xsl:analyze-string
:When this transformation is applied on the following XML document:
the correct result is produced:
This code (from another answer) is wrong:
When applied on the above XML document it produces: