Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 在xslt中创建组合框_Xml_Xslt_Combobox - Fatal编程技术网

Xml 在xslt中创建组合框

Xml 在xslt中创建组合框,xml,xslt,combobox,Xml,Xslt,Combobox,这个值来自xml,我必须使用XSLT1.0创建一个组合框 这是我从数据库中获取的xml: <CER_Pot> <Record CIMtrek_CERPot="Bus Dev|Ser Del|Sol Del|?" /> </CER_Pot> 如何在xslt中实现这一点 请帮我完成他的任务 致以最诚挚的问候尝试以下XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet ver

这个值来自xml,我必须使用XSLT1.0创建一个组合框

这是我从数据库中获取的xml:

<CER_Pot>
  <Record CIMtrek_CERPot="Bus Dev|Ser Del|Sol Del|?" />
</CER_Pot>
如何在xslt中实现这一点

请帮我完成他的任务

致以最诚挚的问候

尝试以下XSLT:

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

    <xsl:template match="/">
        <select size="1" style="width:60%;" name="CIMtrek_CI_CER_Pot" id="CIMtrek_CI_CER_Pot">
            <option value="0">Select Fund Pot</option>
            <xsl:for-each select="//CER_Pot/Record">
                <xsl:variable name="selectValues">
                    <xsl:call-template name="tokenize">
                        <xsl:with-param name="pText" select="@CIMtrek_CERPot"/>
                        <xsl:with-param name="pDelim" select="'|'" />
                    </xsl:call-template> 
                </xsl:variable>

                <xsl:for-each select="$selectValues/item">
                    <xsl:variable name="curItem" select="." />
                    <option>
                        <xsl:if test="//Record/CIMtrek_CERPot/text()=$curItem">
                            <xsl:attribute name="selected">true</xsl:attribute>
                        </xsl:if>
                        <xsl:attribute name="value"><xsl:value-of select="$curItem"/></xsl:attribute>

                        <xsl:value-of select="$curItem"/>
                    </option>
                </xsl:for-each>
            </xsl:for-each>
        </select>
    </xsl:template>

    <xsl:template name="tokenize">
        <xsl:param name="pText"/>
        <xsl:param name="pDelim"/>

        <xsl:if test="string-length($pText)">
            <item>
                <xsl:value-of select="substring-before($pText, $pDelim)"/>
            </item>

            <xsl:call-template name="tokenize">
                <xsl:with-param name="pText" select="substring-after($pText, $pDelim)"/>
                <xsl:with-param name="pDelim" select="$pDelim" />
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>

选择基金罐
真的

combobox是一个UI控件,它是下拉菜单(在HTML中选择)和文本输入(文本类型输入)的组合(因此得名)。HTML没有任何表示为组合框的本机控件。你有一个选择。称之为select。感谢您的帖子,但我收到了一个异常
错误:“错误检查表达式“FilterParentPath(变量ref(selectValues/result tree),step(“child”,26))”的类型。”
@Anto:我在我交付的XSLT和您交付的XSLT中都没有找到这个表达式。很抱歉,但我无能为力。谢谢你的评论,当我添加你的代码时,我得到了这个异常,我应该给出我的xsl文件吗?
Bus Dev
Ser Del
Sol Del
?
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html"/>

    <xsl:template match="/">
        <select size="1" style="width:60%;" name="CIMtrek_CI_CER_Pot" id="CIMtrek_CI_CER_Pot">
            <option value="0">Select Fund Pot</option>
            <xsl:for-each select="//CER_Pot/Record">
                <xsl:variable name="selectValues">
                    <xsl:call-template name="tokenize">
                        <xsl:with-param name="pText" select="@CIMtrek_CERPot"/>
                        <xsl:with-param name="pDelim" select="'|'" />
                    </xsl:call-template> 
                </xsl:variable>

                <xsl:for-each select="$selectValues/item">
                    <xsl:variable name="curItem" select="." />
                    <option>
                        <xsl:if test="//Record/CIMtrek_CERPot/text()=$curItem">
                            <xsl:attribute name="selected">true</xsl:attribute>
                        </xsl:if>
                        <xsl:attribute name="value"><xsl:value-of select="$curItem"/></xsl:attribute>

                        <xsl:value-of select="$curItem"/>
                    </option>
                </xsl:for-each>
            </xsl:for-each>
        </select>
    </xsl:template>

    <xsl:template name="tokenize">
        <xsl:param name="pText"/>
        <xsl:param name="pDelim"/>

        <xsl:if test="string-length($pText)">
            <item>
                <xsl:value-of select="substring-before($pText, $pDelim)"/>
            </item>

            <xsl:call-template name="tokenize">
                <xsl:with-param name="pText" select="substring-after($pText, $pDelim)"/>
                <xsl:with-param name="pDelim" select="$pDelim" />
            </xsl:call-template>
        </xsl:if>
    </xsl:template>
</xsl:stylesheet>