【问题标题】:need to replace xslt sentance containing . (dot ) with white space需要替换包含 . (点)带空白
【发布时间】:2012-10-31 13:59:06
【问题描述】:

description/@text 有一个包含 .dot 的句子,我想用空格替换它。

            <xsl:call-template name="playByPlayJson">
                <xsl:with-param name="sequenceNumber" select="position()"/>

        <xsl:with-param name="summaryPhrase" select="description/@text"/>
        <xsl:with-param name="outs" select="@outs-aft"/>
                <xsl:with-param name="baseSit" select="@base-sit-aft"/>
                <xsl:with-param name="hasScored" select="@scored"/>
                <xsl:with-param name="hasOutOccured" select="@outs-aft - @outs-bef &gt; 0"/>
                <xsl:with-param name="inning" select="../inning/@number"/>
                <xsl:with-param name="inningHalves" select="substring(../inning/@half, 1, 1)"/>
                <xsl:with-param name="awayScore" select="@vis-score"/>
                <xsl:with-param name="homeScore" select="@home-score"/>
                <xsl:with-param name="eventAt" select="$eventAt"/>
                <xsl:with-param name="type" select="@id"/>
            </xsl:call-template>

            <xsl:if test="$eventAt = ''">
                <xsl:if test="position() != last()">,</xsl:if>
            </xsl:if>
        </xsl:for-each>
    <xsl:text>]</xsl:text>  

【问题讨论】:

  • 请显示示例输入 XML 和所需的输出 XML。

标签: java xml xslt text


【解决方案1】:

试试;

<xsl:with-param name="summaryPhrase" select="translate(description/@text,'.',' ')"/>

【讨论】:

    猜你喜欢
    • 2011-09-10
    • 2016-02-23
    • 2015-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多