2016-09-03 2 views
0

에서 유로 기호와 공간을 제거 나는 XML이있다 : 쉼표 아래 이루어집니다는 XSLT 1.0

<price> 
    <now>€ 249,95</now> 
</price> 

양은 전에, 나는 단지 유럽뿐만 아니라 서명을 제거 할.

이것은 (XSLT 1.0) 무슨이다 :

<xsl:template name="amount"> 
    <xsl:param name="string"/> 
    <xsl:param name="separator" select="','"/> 

    <xsl:choose> 
    <xsl:when test="contains($string,$separator)"> 

     <xsl:value-of select="substring-before($string,$separator)"/> 

    </xsl:when> 
    <xsl:otherwise> 
     <xsl:value-of select="$string"/> 
    </xsl:otherwise> 
    </xsl:choose> 
</xsl:template> 
+0

'substring-after ($ string, "")'? – GSerg

답변

1

왜 당신은 간단하지 않습니다

<xsl:value-of select="translate(now, ',€ ', '.')" /> 

이 점에 소수 쉼표를 변환 유로 기호를 제거합니다 어떤 공간이든 - 존재할지를 테스트 할 필요없이.

<xsl:value-of select="floor(translate(now, ',€ ', '.'))" /> 

귀하의 예제에서 249를 반환합니다 : 당신 만 정수 부분을, 원하는 경우

.