XSL子串与另一个字符串

时间:2014-12-16 07:10:10

标签: xml xslt

我的XML

<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet type="text/xsl" href="Results.xsl"?>
  <TestCase>
    <Details>

    <platform>Windows 7-Firefox\prod</platform>

    </Details>
  </TestCase>

我需要检索Windows 7 Firefox prod,因为单个字符串能够检索除&#34; Firefox&#34;之外的所有字符串,请帮助检索它

我的XSL

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>


       <OS><xsl:value-of select="substring-before(TestCase/Details/platform, '-')"/></OS>
<inst><xsl:value-of select="substring-after(TestCase/Details/platform, '\')"/></inst>

<brow><xsl:value-of select="substring-before(substring-after(TestCase/Details/platform, '\'),'-')"> </brow>

  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

1 个答案:

答案 0 :(得分:1)

你有这个倒退(并且没有结束!):

<brow><xsl:value-of select="substring-before(substring-after(TestCase/Details/platform, '\'),'-')"> </brow>

应该是:

<brow>
    <xsl:value-of select="substring-before(substring-after(TestCase/Details/platform, '-'),'\')"/> 
</brow>