Hello Aaron,
before I start exploring how rusty my OQL skills have become :), let’s have a look at an XQuery to accomplish the goal you set out in the initial posting.
I think that the easiest thing to do is just to combine the two XPath queries into a single XQuery, for example:
for $ifcRel in input()/BLIS-XML/IfcRelAssignsProperties
let $ifcRef := input()/BLIS-XML/node()[@XMLID = $ifcRel/@RelatedObjects]
return $ifcRef</pre><BR>This is just a first go - we can refine/tune the query to work with your schema. As I don't have the schema, I just made a simple test document (which you can find at the end of this posting).<BR><BR>This XQuery will iterate through all the /BLIS-XML/IfcRelAssignsProperties nodes, and return any child nodes where the value of the XMLID attribute matches that of the RelatedObjects attribute.<BR><BR>I wasn't entirely sure what you meant by "the reference could be more than 5 levels". Perhaps it is the wrong approach, but I buried a matching node five levels deep in my test document (it is called IfcOther).<BR>The expression /BLIS-XML/node() will return three nodes from the test document: IfcRelAssignsProperties, levelOne (and all its children) and IfcWall.<BR>As there is no XMLID attribute in the levelOne node, this is not matched by the query and neither is (its child) the IfcOther node.<BR>To match this node the filter condition can be changed to [//@XMLID=...] so that the attribute is searched for on all levels (this costs more time, of course).<BR><BR>I hope that this helps, but if it doesn't answer all your questions please let me know.<BR>The next step should probably be to have a look at the schema, some example documents and example results that you would like to get from the queries.<BR><BR>Greetings,<BR>Trevor.<BR><BR>The test XML Document:<BR><pre class="ip-ubbcode-code-pre">
<?xml version="1.0" encoding="UTF-8" ?>
<BLIS-XML>
<IfcRelAssignsProperties DomainView="Generic"
GlobalId="|.CYF$>o+Hw=#rH0,xe8"
OwnerHistory="i501"
RelatedIsDependent="0"
RelatedObjects="i962"
RelatingIsDependent="1"
RelatingPropertyDefinition="i554"
XMLID="i606" />
<levelOne>
<levelTwo>
<levelThree>
<levelFour>
<levelFive>
<IfcOther GlobalId="gRB*gk/YT?w=slF/,,=!"
Label="Top wall#5"
LayerInformation="i480"
LocalPlacement="i431"
OwnerHistory="i501"
Representations="i519"
XMLID="i962"
calcWallArea="35"
calcWallVolume="8.75" />
</levelFive>
</levelFour>
</levelThree>
</levelTwo>
</levelOne>
<IfcWall GlobalId="gRB*gk/YT?w=slF/,,=!"
Label="Top wall#5"
LayerInformation="i480"
LocalPlacement="i431"
OwnerHistory="i501"
Representations="i519"
XMLID="i962"
calcWallArea="35"
calcWallVolume="8.75" />
</BLIS-XML>
#Tamino#API-Management#webMethods