- replace a String with XSLT
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:inm="http://www.inmagic.com/webpublisher/query" version='1.0'>
- <xsl:output method="text" encoding="UTF-8"/>
- <xsl:preserve-space elements="*"/>
- <xsl:template match="text()"></xsl:template>
- <xsl:template match="test">
- <xsl:apply-templates/>
- <xsl:for-each select="testObj">
- 'Notes or subject' <xsl:call-template name="rem-html"><xsl:with-param name="text" select="SBS_ABSTRACT"/></xsl:call-template>
- </xsl:for-each>
- </xsl:template>
- <xsl:template name="rem-html">
- <xsl:param name="text"/>
- <xsl:variable name="newtext" select="translate($text,'a','b')"/>
- </xsl:template>
- </xsl:stylesheet>
- <soap:address location="http://localhost:4434/miniwebservice"/>
- <soap:address location="http://localhost:4433/miniwebservice"/>
- <xsl:template match="soap:address/@location">
- <xsl:attribute name="location">
- <xsl:call-template name="string-replace">
- <xsl:with-param name="haystack" select="current()"/>
- <xsl:with-param name="search">:4434/</xsl:with-param>
- <xsl:with-param name="replace">:4433/</xsl:with-param>
- </xsl:call-template>
- </xsl:attribute>
- </xsl:template>
- <xsl:template match="@* | node()">
- <xsl:copy>
- <xsl:apply-templates select="@* | node()"/>
- </xsl:copy>
- </xsl:template>
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="..."
- version="2.0">
- <xsl:param name="newPort">4433</xsl:param>
- <xsl:template match="@*|node()">
- <xsl:copy>
- <xsl:apply-templates select="@*|node()"/>
- </xsl:copy>
- </xsl:template>
- <xsl:template match="soap:address/@location">
- <xsl:attribute name="location">
- <xsl:value-of select="replace(.,
- '^(http://[^/]*:)[0-9]{4}/',
- concat('$1',$newPort,'/'))"/>
- </xsl:attribute>
- </xsl:template>
- </xsl:stylesheet>