开发者

XSLT: replace text between two nodes

I'm new at XSLT, and I would like to know if there is a function to perform the following task:

Imagine I have the following xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<text> blabla ? blabl ?  abla ?  </text>

I would like to apply a template to replace each "?" with "." when I transform my xml. Here is the xslt template i would like to have:

<xsl:template match="text">
        <xsl:replace="? with ."/> //I know it doesn't work, I just want to know if there is a function to perform something like this
  </xsl:templ开发者_JAVA技巧ate>

Is it possible? I learned with the w3school tutorial, and there is nothing there to perform this task.(It's a very basic tutorial) Can you advise me a good tutorial or book to learn xsl.


Yes, this is possible. There are several generic solutions to do string replacement with XSLT here on StackOverflow, so I will not write another one and instead just link to some of them.

  • How to remove particular characters from a string using XSLT?
  • Find and Replace with Unique
  • xslt1.0 replace is not working
  • XSLT multiple replacing
  • there are more

Instead of voting for this answer, please vote for the one that you ended up using/that helped you most.


translate function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜