Re: [xml] [XPATH] Nested function calls issue?



Mariano Guadagnini <mguadagnini gmail com> writes:

Hey guys,Â

How are you doing? Well, i've been having an issue with Xpath, using stacked
xpath function calls like the one above:


fn:replace('abcdefghi','a',fn:replace('abcdefghi','b','B'))

You didn't give much context, but I think you are using the wrong
prefix.

~/src/xml/sandbox$ cat replace.xsl 
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:str="http://exslt.org/strings"; 
version="1.0" extension-element-prefixes="str">
  <xsl:output omit-xml-declaration="yes" indent="no"/>
  <xsl:template match="/">
    <xsl:value-of select="str:replace('abcdefghi', 'a', str:replace('abcdefghi', 'b', 'B'))"/>
    <xsl:text>
      ====
</xsl:text>
    <xsl:value-of select="fn:replace('abcdefghi', 'a', fn:replace('abcdefghi', 'b', 'B'))"/>
  </xsl:template>
</xsl:stylesheet>
~/src/xml/sandbox$ echo '<x/>' | xsltproc replace.xsl -
xmlXPathCompOpEval: function replace bound to undefined prefix fn
xmlXPathCompOpEval: function replace bound to undefined prefix fn
xmlXPathCompiledEval: 4 objects left on the stack.
aBcdefghibcdefghi
      ====
B



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]