Re: [xml] xml find and replace
- From: stuart shepherd <jonny wark googlemail com>
- To: Noam Postavsky <npostavs users sourceforge net>
- Cc: xml gnome org
- Subject: Re: [xml] xml find and replace
- Date: Mon, 16 Jul 2012 13:40:11 +0100
Brilliant I've now got this
<?xml version="1.0" encoding="utf-8"?>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="//control[name='DelaySeconds']/numeric/max/text()">
<xsl:text>5</xsl:text>
</xsl:template>
<xsl:template match="//control[name='DelaySeconds']/numeric/scalemax/text()">
<xsl:text>5</xsl:text>
</xsl:template>
</xsl:stylesheet>
And it seems to work, thanks for your help.
On Mon, Jul 16, 2012 at 1:22 PM, Noam Postavsky
<npostavs users sourceforge net> wrote:
On Mon, Jul 16, 2012 at 6:09 AM, stuart shepherd
<
jonny wark googlemail com> wrote:
> <xsl:template match="//control[name='DelaySeconds']/numeric/max">
> <xsl:element name="{name(.)}">
> <xsl:value-of select="translate(string(.), '110', '5')" />
> </xsl:element>
> </xsl:template>
I think you could just do
<xsl:template match="//control[name='DelaySeconds']/numeric/max[. =
110]/text()">
<xsl:text>5</xsl:text>
</xsl:template>
Actually I guess you don't care about the original value so you don't
even need the [. = 110] part.
> I've tried using replace instead of translate but I get the error message
>
> xmlXPathCompOpEval: function replace not found
> XPath error : Unregistered function
replace is an Exslt function, add xmlns:str="http://exslt.org/strings"
to your root node,
then you can call str:replace.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]