XPath Query With Multiple Arrays



I have the following XML structure:



<xml>
<header>
(Tags goes here)
</header>
<listItem>
<id></id>
...
(Sort of data)
...
<arrayType1>
<id></id>
<parentId></parentId>
<!-- Key: Data to lookup and get the entire structure (listItem) with XPath-->
<key></key>
</arrayType1>
<arrayType2>
<id></id>
<parentId></parentId>
<!-- Key: Data to lookup and get the entire structure (listItem) with XPath-->
<key></key>
</arrayType2>
</listItem>
<listItem>
(Exactly same structure with different data as above)
</listItem>
</xml>


Tag <parentId> has the same data of <listItem><id> tag (not to be confused with <id> of each arrayType).


I need an XPath expression that returns the or only having the data (or, by default, return the entire arrayTypeX and process later in another XSLT transformation).


I need this for a transformation in a XSLT Map in IBM Integration Designer (Websphere ESB), but i'm very confused about the XPath expression, but, the point is merely in build that XPath Expression.


I've tried with this expression:


/listItem[arrayType1[key = 'value']]/parentID


But i don't know if XPath supports that kind of expression (array inside array looking for a specific value). That expression always return the first ID of the list.


The Cardinality for each item is:



header: [0..1]
listItem: [0..*]
arrayType1: [0..*]
arrayType2: [0..*]


Can you shed some light about this?


Thanks


No comments:

Post a Comment