I have an xml document which is formatted like this:
<wsc>
<entries>
<id>1</id>
</entries>
<entries2keywords>
<entryId>1</entryId>
<keywordId>1</keywordId>
</entries2keywords>
<entries2keywords>
<entryId>1</entryId>
<keywordId>2</keywordId>
</entries2keywords>
<keywords>
<id>1</id>
<keyword>kw1</keyword>
</keywords>
<keywords>
<id>2</id>
<keyword>kw2</keyword>
</keywords>
</wsc>
I'm trying to parse it so I can store all the keywords that belong to an Element. So far I'm traversing all entries2keywords and looking for a matching entryId using this xpath expression:
//entries2keywords[entryId='1']/keywordId
Which returns the keywordId fine.
However, I'm looking for a way to select the actual keyword right away, so something like this (pseudocode):
//keywords[contains (id, //entries2keywords[entryId='1']/keywordId) ]/keyword
I realize it's badly formatted XML, but unfortunately I can't change it.