У меня есть следующий код:использование множественного в <XSL: Имя параметра = выберите> XSL
<xsl:variable name="landlord"><xsl:value-of select="agreement/landlord1name"/></xsl:variable>
<xsl:variable name="tenant"><xsl:value-of select="agreement/tenantname"/></xsl:variable>
<xsl:variable name="property"><xsl:value-of select="agreement/propertyname"/></xsl:variable>
<xsl:variable name="startdate"><xsl:value-of select="agreement/startdate"/></xsl:variable>
<xsl:variable name="period"><xsl:value-of select="agreement/agreementterm"/></xsl:variable>
<xsl:variable name="lbody">
<xsl:call-template name="replace-text-multi">
<xsl:with-param name="text" select="tatemplate/letterbody"/>
<xsl:with-param name="replaces" select="'#tenant #period'"/>
<xsl:with-param name="bys" select="$tenant"/>
<xsl:with-param name="delim" select="' '"/>
</xsl:call-template>
</xsl:variable>
Это код для имени шаблона = заменить полнотекстового:
<xsl:template name='replace-text'>
<xsl:param name='text'/>
<xsl:param name='replace'/>
<xsl:param name='by'/>
<xsl:choose>
<xsl:when test='contains($text, $replace)'>
<xsl:value-of select='substring-before($text, $replace)'/>
<xsl:value-of select='$by' disable-output-escaping='yes'/>
<xsl:call-template name='replace-text'>
<xsl:with-param name='text' select='substring-after($text, $replace)'/>
<xsl:with-param name='replace' select='$replace'/>
<xsl:with-param name='by' select='$by'/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select='$text'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Это код для имени шаблона = заменить текстовый мультимиллионера:
<xsl:template name="replace-text-multi">
<xsl:param name="text"/>
<xsl:param name="replaces"/>
<xsl:param name="bys"/>
<xsl:param name="delim"/>
<xsl:choose>
<xsl:when test="contains($replaces, $delim)">
<xsl:variable name="textSoFar">
<xsl:call-template name="replace-text-multi">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="replaces" select="substring-after($replaces, $delim)"/>
<xsl:with-param name="bys" select="substring-after($bys, $delim)"/>
<xsl:with-param name="delim" select="$delim"/>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="replace-text">
<xsl:with-param name="text" select="$textSoFar"/>
<xsl:with-param name="replace" select="substring-before($replaces, $delim)"/>
<xsl:with-param name="by" select="substring-before($bys, $delim)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="replace-text">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="replace" select="$replaces"/>
<xsl:with-param name="by" select="$bys"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
здесь я хочу заменить #tenant как $ арендатора и #period как $ период, но XSL не может читать выберите = "$ tenant $ period". Кто-то, пожалуйста, помогите
Покажите нам шаблон. –
У меня есть код для шаблона. – Izan
Чтобы убедиться: если вы хотите заменить '# tenant' на' $ tenant', вы, конечно же, хотите заменить строку '' # tenant'' значением ** ** переменной с именем ' tenant'? – potame