У меня есть следующий код в XSL 2.0. Однако из-за ограничений, налагаемых средой, я должен вернуться к версии XSL 1.0. Так как функции не разрешены в XSL 1.0, как я буду делать следующее в 1.0?XSLT 1.0 - вместо функции
<!-- a custom 'contains' implementation -->
<xsl:function name="my:contains" as="xs:boolean">
<xsl:param name="str" as="xs:string" />
<xsl:param name="list" as="xs:string+" />
<xsl:variable name="temp" as="xs:boolean*">
<xsl:for-each select="$list">
<xsl:if test="contains($str, .)">
<xsl:sequence select="xs:boolean('true')" />
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:sequence select="if ($temp[1] = xs:boolean('true')) then xs:boolean('true') else xs:boolean('false')" />
</xsl:function>
<xsl:param name = "excludedSections"
select = "('AboutThis','79','GetMore')"/>
**Being used as**
<xsl:if test = "(not(my:contains($sectionId, $excludedSections))
and
(contains(
concat(' ', @IncludedDevices, ' '),
concat(' ', $targetedDevice, ' ')
) `enter code here`
or
not(@IncludedDevices)
)
and
(not(contains(
concat(' ', @ExcludedDevices, ' '),
concat(' ', $targetedDevice, ' ')
))
or
not(@ExcludedDevices)
))">
.......Do something....
</xsl:if>
Спасибо, GP
Вы можете рассмотреть http://codereview.stackexchange.com/, если вы ищете обзор данного кода. –
@StephenReindl Речь идет о «переводе» текущего кода с 2.0 на 1.0, который ** не относится к обзору кода –
@GP_help, если ваш комментарий относится к моему ответу, тогда вы можете принять его, чтобы ваш вопрос был помечен как ответил. –