-2
나는 각각 XML로 "
및 '
로 싱글/더블 따옴표를 대체 변환하려고에게 대체XSLT 버전 1 싱글/더블 따옴표
나는 누군가가 도울 수 있다면 그래서 아주 많이 감사 XSL 매우 새로운 오전
나는 각각 XML로 "
및 '
로 싱글/더블 따옴표를 대체 변환하려고에게 대체XSLT 버전 1 싱글/더블 따옴표
나는 누군가가 도울 수 있다면 그래서 아주 많이 감사 XSL 매우 새로운 오전
동적 인 대체 방법을 사용하면 매개 변수가있는 별도의 템플리트를 입력 텍스트로 작성하고 대체 할 대상을 바꿀 수 있습니다.
따라서, 예에서 입력 텍스트는 다음과 같습니다
Your text "contains" some "strange" characters and parts.
XSL 예 아래에서는 "(') "
및 '
와 "
()"의 교체 볼 수 있습니다 : 다음
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<!--template to replace-->
<xsl:template name="template-replace">
<xsl:param name="param.str"/>
<xsl:param name="param.to.replace"/>
<xsl:param name="param.replace.with"/>
<xsl:choose>
<xsl:when test="contains($param.str,$param.to.replace)">
<xsl:value-of select="substring-before($param.str, $param.to.replace)"/>
<xsl:value-of select="$param.replace.with"/>
<xsl:call-template name="template-replace">
<xsl:with-param name="param.str" select="substring-after($param.str, $param.to.replace)"/>
<xsl:with-param name="param.to.replace" select="$param.to.replace"/>
<xsl:with-param name="param.replace.with" select="$param.replace.with"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$param.str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="/">
<xsl:call-template name="template-replace">
<!--put your text with quotes-->
<xsl:with-param name="param.str">Your text "contains" some "strange" characters and parts.</xsl:with-param>
<!--put quote to replace-->
<xsl:with-param name="param.to.replace">"</xsl:with-param>
<!--put quot and apos to replace with-->
<xsl:with-param name="param.replace.with">"'</xsl:with-param>
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>
교체 결과는 다음과 같습니다.
Your text "'contains"' some "'strange"' characters and parts.
희망 lp.
지금까지 시도한 내용의 예를 제공해주십시오. –
아래 답변을 참조하십시오. 도움이되기를 바랍니다. 추후 질문을 위해 다른 사용자의 "다운 투표"를 피하기위한 구체적인 요구 사항이있는 입력 데이터를 제공하십시오. –