views:

33

answers:

1

I am using xPath to do some ETL work from a dictionary lookup file. I need to be able to look for the translation key and return the translated value. For example I need to be able to look for "prioremployment" and have it return "Prior Employment".

This will return an array of all the translate nodes (I am using ColdFusion 9):

XMLSearch(xmlDoc, "//translate")

Here is the XML I am working with:

<dictionary>
 <category value="additionalinfo">
        <translate value="prioremployment">Prior Employment</translate>
 </category>
 <category value="bilingualnarratives">
    <translate value="narr_priorexpLOT">Prior Bilingual Experience</translate>
 </category>
 <category value="certification">
    <translate value="cell_phonehours">Cell Phone Hours</translate>
    <translate value="dlexp">Driver's License Exp. Date</translate>
 </category>
</dictionary>
+2  A: 

This?

//translate[@value='KEY']
gpeche
@gpeche: Even `/*/*/translate[@value='prioremployment']` would be better. Don't start a path with `//` operator when there is no need to.
Alejandro
Thanks guys this works great.
resonantmedia