tags:

views:

19

answers:

2

I have this line:

<xsl:when test="document('foo.xml')/field_config/field_rename/field[@old_name = $name]/@new_name">

foo.xml:

<field_config>
 <field_rename>
<field old_name="Modified" new_name="modification"/>
<field old_name="Created" new_name="creation"/>
</field_rename>
</field_config>

In general, what is this testing?

+1  A: 

That means:

Exist an attribute named new_name for some field element having an attribute old_name equal to $name (var or param reference) and being child of field_rename and grand child of field_config root element in foo.xml document

Alejandro
A: 

If I read it correctly, it is testing for the "existence" of the following attribute.

foo.xml
  /field_config
    /field_rename
      /field[@old_name = $name]
        /@new_name

Which "reads" as (going backwards)...:

If there is a "new_name" attribute on a field node (where the attribute old_name = "someVariable") in a field_rename node, in a field_config node, in foo.xml... then do (whatever)

scunliffe