Subject: Re: [xsl] Creating strings with apos and replacing From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 13 May 2025 19:04:49 -0000 |
Trplle apos does the trick for defining the variable, but doesn't work for the replace().Sent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 5/13/25 11:51 AM (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Creating strings with apos and replacing On 13/05/2025 20:40, dvint@xxxxxxxxx wrote:> My main question is the correct way to use replace() to remove special > characters and spaces that appear in document titles. Some I just want > to remove and others I want to translate to something else.>> I have this much working>> <xsl:function name="ping:gen_id">> B B B B <xsl:param name="INSTRING"/>> B B B B <xsl:value-of select="translate(replace(lower-case($INSTRING), ' > ', '_'),> B B B B ':()','')"/>> </xsl:function>>> To the replace I wanted to add the ' character to replace with > nothing. I tried adding \' \\' &apo; '' to no avail.In XPath 2.0 and later you can use two single quotes inside a single quoted string e.g. ':()''' or ''''.>> This iss a sample of a string I'm trying to modify:>> "Step 9: Create the application's resource access grant">> So I asked coPilot what should be done and it came up with:>> <xsl:template match="/">> B B B <xsl:variable name="inputString" select="'This is a string with a > single quote: 'example''" />> B B B <xsl:variable name="outputString" select="translate($inputString, > '', '')" />> B B B <xsl:value-of select="$outputString" />> </xsl:template>>> This throws a different error around creating the inputString.>> Unexpected token name "example" beyond end of expression>> Which leads to the other part of my question about how you would > create a string variable with an ' in the content. I imagine it > will be the same answer, but wanted to post this for completion of the > question.>> B 'This is a string with a single quote: ''example'''
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Creating strings with apo, Martin Honnen martin | Thread | Re: [xsl] Creating strings with apo, David Carlisle d.p.c |
Re: [xsl] Creating strings with apo, Martin Honnen martin | Date | Re: [xsl] Creating strings with apo, David Carlisle d.p.c |
Month |