I’ve got the following xml:
<vo class="GroupEntry" buildByAlias="true">
<objectClass name="groupOfNames"/>
<field name="commonName" nameLDAP="cn" type="String"/>
<field name="descriptione" nameLDAP="description" type="String"/>
<field name="member" nameLDAP="member" type="String[]"/>
</vo>
<update method="addMember" modificationMode="ADD_ATTRIBUTE">
<input>
<field name="member"/>
<field name="description"/>
</input>
</update>
I’m using XSLT to transform it, and I’m need, for each update, to get the fields in the vo that correspond to the field defined in the input. It would be something like this:
<xsl:variable name="fields" select="vo/field" />
<xsl:for-each select="update">
<xsl:variable name='fieldsForInput' select = "$fields[@name]=input/fields[@name]"/>
<xsl:for-each select="$fieldsForInput">
<xsl:value-of select="@type"/> <xsl:value-of select="@name"/>
<xsl:for-each>
</xsl:for-each>
But it doesn’t found anything. Any ideas?
Thanks
JL
From the shown fragments it’s difficult helping you and understadning what you want. However your case seems perfect for using
xsl:key.For example, if you create a key at the beginning of the transform like this:
You can use it inside your matching template as follows:
I would not use a
xsl:foreachanyway. But it’s hard to give you a complete solution if you provide only fragments. Also is not clear if you want just match or replacefield.Example showing how to get the field
name/typefor eachupdate/input/field.XSLT 1.0 tested with Saxon 6.5.5
Applied on:
Produces: