简体   繁体   English

XSLT 1.0 xslt引擎中内置的altova xmlspy是否不具有节点集功能?

[英]XSLT 1.0 Does altova xmlspy built in xslt-engine does not have node-set function?

Hi i am using an external named template in my xslt that tokenize a string and store it in a variable. 嗨,我在xslt中使用外部命名模板,该模板对字符串进行标记化并将其存储在变量中。 I am using Altova XML SPY and i am restricted to xslt 1.0. 我正在使用Altova XML SPY,并且仅限于xslt 1.0。 The Problem is each time i have to change option from Built-in XSLT engine to Microsoft. 问题是每次我必须将内置XSLT引擎选项更改为Microsoft时。 Is there any node-set function or some other function instead of node-set in built-in xslt engine 内置xslt引擎中是否有任何节点集功能或某些其他功能代替节点集

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:import href="tokenize.xsl"/>
<xsl:template match="/string/upara">

        <xsl:variable name="string">
            <xsl:call-template name="tokenizeString">
                <xsl:with-param name="list" select="/string/upara"/>
                <xsl:with-param name="delimiter" select="' '"/>

            </xsl:call-template>
       </xsl:variable>



<xsl:for-each select="msxsl:node-set($string)/word">
    <xsl:value-of select="string-length(.)" />
</xsl:for-each>
 </xsl:template>
 </xsl:stylesheet>

XML i am using is 我正在使用的XML是

<string>
 <upara>This is a small string </upara>
 </string>

The string variable have all the words nodes like this 字符串变量具有所有这样的单词节点

 <string>
 <word>This</word>
 <word>is</word>

Now i have to iterate over each word and find its length 现在我必须遍历每个单词并找到其长度

Please tell me if there is any better way to do it. 请告诉我是否有更好的方法。

I got this working 我得到了这个工作

Sorry i am new to XSLT 1.0 and got confused. 抱歉,我是XSLT 1.0的新手,感到困惑。 Instead of using node-set I simply used 我没有使用节点集,而是使用了

<xsl:for-each select="$string/word">
xsl:value-of select="string-length(.)" />
<br></br>
</xsl:for-each>

It works Perfect without changing engine :) :D 它工作完美,而无需更改引擎:):D

XML Spy has a habit of treating result tree fragments (RTF) as if they were nodesets. XML Spy习惯于将结果树片段(RTF)视为节点集。 I can't find any documentation that states this directly, but it is something you will find. 我找不到任何直接说明这一点的文档,但是您会发现它。

Any xsl command that returns a (RTF) and is stored in a variable, can be queried as if it were a node-set, for example by using xsl:value-of . 例如,通过使用xsl:value-of ,可以查询任何返回(RTF)并存储在变量中的xsl命令,就好像它是节点集一样。

This question , has a few XSLT-engine non-specific appraches that may be worth looking at. 这个问题 ,有一些XSLT引擎非特定方法可能值得研究。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM