Xml 需要在xslt中为每个in选择使用

Xml 需要在xslt中为每个in选择使用,xml,xslt,Xml,Xslt,我有一个要求,即我需要在xslt中的choose中仅对when条件中的每个条件使用 Input:`<input>baz</input> <input>haz</input> <input>nan</input>` XSLT: 非常感谢您提供的任何帮助。如果您提供了格式良好的输入,例如: XML 以下样式表: XSLT1.0 将返回: <?xml version="1.0" encoding="UTF-8"?>

我有一个要求,即我需要在xslt中的choose中仅对when条件中的每个条件使用

Input:`<input>baz</input>
<input>haz</input>
<input>nan</input>`
XSLT:

非常感谢您提供的任何帮助。

如果您提供了格式良好的输入,例如:

XML

以下样式表:

XSLT1.0

将返回:

<?xml version="1.0" encoding="UTF-8"?>
<output>true</output>
附言

如果愿意,可以将样式表缩短为:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/root">
    <output>
        <xsl:value-of select="input='haz'"/>
    </output>
</xsl:template> 

</xsl:stylesheet>

不,只是它必须是真的或假的。Sry可以有任何一个。您不需要使用特定的编码结构。您需要从特定输入生成特定输出。告诉我们输入和所需的输出,我们将告诉您需要编写什么代码。
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/root">
    <output>
        <xsl:choose> 
            <xsl:when test="input='haz'">true</xsl:when>
            <xsl:otherwise>false</xsl:otherwise>
        </xsl:choose> 
    </output>
</xsl:template> 

</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<output>true</output>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/root">
    <output>
        <xsl:value-of select="input='haz'"/>
    </output>
</xsl:template> 

</xsl:stylesheet>