Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[XSLT]: Remove string in XSLT

I have the string "[test]" in xsl. I need to remove this brackets in the xsl. how can i achieve this in XSL. Please help.

i know this can do it, but how can i remove '[' with below code,

   <xsl:call-template name="string-replace-all">
     <xsl:with-param name="text" select="$string" />
     <xsl:with-param name="replace" select="$replace" />
     <xsl:with-param name="by" select="$by" />
   </xsl:call-template>  

Please help to remove '[' and ']'

like image 528
AJJ Avatar asked Jan 27 '26 15:01

AJJ


1 Answers

Use the translate() function.

Example...

<xsl:call-template name="string-replace-all">
 <xsl:with-param name="text" select="$string" />
 <xsl:value-of select="translate( $text, '[]', '')" />
</xsl:call-template>
like image 148
Sean B. Durkin Avatar answered Jan 30 '26 11:01

Sean B. Durkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!