开发者

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

开发者 https://www.devze.com 2023-04-01 11:06 出处:网络
I would like to be able to select all of the Relationship elements where the Parent_Entity_Ref equals the Entity\'s id.

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

精彩评论

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