[xslt] replacing spaces in an attribute value during transformation



Hi,

I'm using xsltproc to split an xml document into a number of smaller 
documents.  For the filenames of the smaller documents I'd like to an 
attribute value with spaces replaced with underscores and invalid 
characters (such as "?" removed).

I've tried to use the str:replace templates and functions on 
http://exslt.org/, but haven't had much success.

When I try to use str.replace template like so:

    <xsl:call-template name="str:replace">
       <xsl:with-param name="string" select="'foo'" />
       <xsl:with-param name="search" select="'o'" />
       <xsl:with-param name="replace" select="'e'" />
    </xsl:call-template>

xsltproc crashes with an access violation.

If I try to use the function like so:

    <xsl:value-of select="'foo', 'o', 'e')"/>

I get the error:

{http://exslt.org/strings}replace: called with too many arguments
xmlXPathCompiledEval: 2 object left on the stack
runtime error: file split-articles.xsl line 34 element value-of
xsltValueOf: text copy failed
no result for tupleArticle.xml

I'm using:

Using libxml 20506, libxslt 10029 and libexslt 719
xsltproc was compiled against libxml 20506, libxslt 10029 and libexslt 719
libxslt 10029 was compiled against libxml 20506
libexslt 719 was compiled against libxml 20506

I've tried googling around for similar error messages, but haven't found 
anything specifically related to this.

Am I calling the functions incorrectly?  Does anyone have any 
suggestions for how I can replace the spaces?

Thanks,
-Ollie

--
Ollie Rutherfurd
http://www.rutherfurd.net/




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