English 中文(简体)
使用模板参数确定要素调查中使用的属性价值是失败的,但当地界定的地块变量是为什么ok?
原标题:Using template parameter for attribute value used in element lookup fails but locally defined string variable is ok- why?
  • 时间:2011-07-22 07:28:41
  •  标签:
  • xml
  • xslt

我需要确定,是否存在着某种价值的名称归属要素。 我需要搜索的文件不是适用风格的文件。 我愿将直线价值转至模板。 当我这样做时,这种研究失败了,但当我在模板中形成一个地方变量,并在研究前使用这一变量时,会取得成功。 我不能理解为什么。

我用两种不同的xsl发动机对其进行审判,这两种发动机都表现出同样的行为。

模板如下所示。 我愿寻找一个标明名称的信号元件,等于“......”之前的果园。

第一个失败了,但第二个失败了,模板中给出了搜索余地。 为什么?

    <xsl:template name="portIsSigObjOrQuality">
    <xsl:param name="portName" />

    <xsl:variable name="nameOfCompoundInstanceFromPort"
     select="substring-before($portName, __ )" />

  <xsl:choose>
     <xsl:when
        test="$signalLookupDoc/signals/signal[./@name=$nameOfCompoundInstanceFromPort]">
        <xsl:text>yes</xsl:text>
     </xsl:when>
     <xsl:otherwise>
        <xsl:text>no</xsl:text>
     </xsl:otherwise>
  </xsl:choose>

    <xsl:variable name="nameOfCompoundInstanceFromString"
        select="substring-before( EssBypassValveAM__sdfsdf ,  __ )" />

    <xsl:choose>
        <xsl:when
            test="$signalLookupDoc/signals/signal[./@name=$nameOfCompoundInstanceFromString]">
            <xsl:text>yes</xsl:text>
        </xsl:when>
        <xsl:otherwise>
            <xsl:text>no</xsl:text>
        </xsl:otherwise>
    </xsl:choose>
    <xsl:text>;&#10;</xsl:text>

</xsl:template>

signalLookupDoc is defined as
<xsl:variable name="signalLookupDoc" select="document($param2)" />

模板称为

<xsl:call-template name="portIsSigObjOrQuality">
            <xsl:with-param name="portName" select=" EssByPassValveAM__Enabled " />
        </xsl:call-template>

谁能向我解释为什么第一次调查失败,以及我坚持做些什么来使其发挥作用?

问题回答

I guess the difference in caps (case-sensitive match)?

EssBypassValveAM

以及

EssByPassValveAM

Note the P vs p.





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

热门标签