Subject: Re: [xsl] Creating strings with apos and replacing From: "dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 13 May 2025 20:08:59 -0000 |
..dan On 2025-05-13 12:19, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx wrote:
On Tue, 2025-05-13 at 18:40 +0000, dvint@xxxxxxxxx wrote:much working
<xsl:function name="ping:gen_id"> <xsl:param name="INSTRING"/> <xsl:value-of select="translate(replace(lower- case($INSTRING), ' ', '_'), ':()','')"/> </xsl:function>
you could use translate() twice here of course. translate($input, ' ', '_')
often i use replace($input, '[^a-z0-9]+', '-', 'i') for generating IDs (and then fix them up to be unique), since e.g. allowing % or < or > or & can also cause interesting problems :)
select="translate($inputString, '', '')" /> \xA0\xA0\xA0\xA0 <xsl:value-of select="$outputString" />
Your problem here is after the XML parser converts ' to ' the XPath processor sees, translate($inputstring, '', '') which is not what you want at all.
select="translate($inputString, "'", '')
will turn into translate($inputString, "'", '') which is what i think you want.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Creating strings with apo, Liam R. E. Quin liam | Thread | Re: [xsl] Creating strings with apo, Michael Kay mike@xxx |
Re: [xsl] Creating strings with apo, Martin Honnen martin | Date | Re: [xsl] Creating strings with apo, Michael Kay mike@xxx |
Month |