开发者

Choose out of context elements where descendant element's value equals context's attribute value

I would like to be able to select all of the Relationship elements where the Parent_Entity_Ref equals the Entity's id.

My current attempt is as follows:

<xsl:apply-templates select="//EMX:Relationship[EMX:RelationshipProps/EMX:Parent_Entity_Ref = @id]" />

And the XML structure is as follows:

<ERwin>
  <EMX:Model>
    <Entity_Groups>
      <Entity id="blah">
        <!--Current Context-->
      </Entity>
    </Entity_Groups>
    <Relationship_Groups>
      <Relationship>
        <RelationshipProps>
          <!--Contains entity id -->
          <Parent_Entity_Ref>blah</Parent_Entity_Ref>
        </RelationshipProps>
      </Relationship>
    </Relationship_Groups>
  </EMX:Model>
</ERwin>

I think what is happening is that it is looking for all Relationship elements within Entity rather than from the whole d开发者_JAVA百科ocument, I have tried adding ancestor axes and that hasn't helped


//Relationship[
    RelationshipProps/Parent_Entity_Ref = ../../Entity_Groups/Entity/@id
]

XML:

<ERwin xmlns:EMX="namespace">
  <EMX:Model>
    <Entity_Groups>
      <Entity id="blah">
        <!--Current Context-->
      </Entity>
    </Entity_Groups>
    <Relationship_Groups>
      <Relationship>
        <RelationshipProps>
          <!--Contains entity id -->
          <Parent_Entity_Ref>blah</Parent_Entity_Ref>
        </RelationshipProps>
      </Relationship>
    </Relationship_Groups>
  </EMX:Model>
</ERwin>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜