0
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 이것은 코드 리뷰 –
@GP_help에 속하지 않는 **에서 ** 현재 코드를 2.0에서 1.0으로 "번역"하는 것입니다. 귀하의 의견이 내 답변을 나타낼 경우 귀하의 질문이 대답했다. –