0

文字として空白を表示しない xslt があります。

この場合、%のみを表示します。

URL:

http://localhost:8888/tire/details/Bridgestone/ECOPIA%EP001S/Bridgestone,ECOPIA%EP001S,195--65%R15%91H,TL,ECO,0

XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:x="http://www.w3.org/1999/xhtml" version="1.0">
  <xsl:param name="extractorHost" />
  <xsl:template match="/">
    <links>
      <xsl:apply-templates />
    </links>
  </xsl:template>
  <xsl:template match="//x:form/x:a[@class='arrow-link forward']">
    <xsl:variable name="url" select="translate(@href, ' ', '%20')"/>
    <link href="{concat($extractorHost, $url)}" />
  </xsl:template>
    <xsl:template match="text()" />
</xsl:stylesheet>

正しい URL は次のとおりです。

http://localhost:8888/tire/details/Bridgestone/ECOPIA%20EP001S/Bridgestone,ECOPIA%20EP001S,195--65%20R15%2091H,TL,ECO,0

XSLT の形式が間違っていますか? ありがとう。

4

2 に答える 2

1

こちらをご覧ください: XSLT 文字列置換

「置換」機能を使用できる既存のテンプレートを使用できます。

于 2013-04-08T16:52:02.647 に答える