starts-with
This is an open discussion with 3 replies, filed under XSLT.
Search
See this utility for string replacement.
<xsl:choose> <!-- Starts with '(' or doesn't contain '(', display normal --> <xsl:when test="starts-with(., '(') or not(contains(., '('))"> <xsl:value-of select="."/> </xsl:when> <!-- Other text, replace with what you need --> <xsl:otherwise> <xsl:value-of select="string:replace(., '(', '<br/>(')" disable-output-escaping="yes"/> </xsl:otherwise> </xsl:choose>
This line outputs
<xsl:value-of select="string:replace(., '(', '<br/>(')" disable-output-escaping="yes"/>
some errors:
xmlXPathCompOpEval: function replace bound to undefined prefix string xmlXPathCompiledEval: 2 objects left on the stack. XPath evaluation returned no result. runtime error: file /.../master.xsl line x element value-of
edit:
starts-with( {$p} , '(')
how to put in the first parameter text input from XML?
string:replace
is an exsl function. Vlad forgot to mention that...
Parameter use in xpath functions don't need the curly braces:
starts-with($p, '(')
Create an account or sign in to comment.
Hi, Some entries starts with string and next opening bracket e.g. Test (test)
OUTPUT:
and some starts only with opening bracket e.g. (test)
OUTPUT:
My question is: How to make condition like this:
<br />
tag before opening bracket or after this string<br />
tagCode: