How to deal with XSLT Multiple templates with same match?
Among these there are 4 categories. Each category has its own given structure. For this reason I have defined 4 different templates. Two categories use the same structure, they are different only in some elements. So they are parsed with the same match.
Here the partial XSLT file.
<xsl:template match="pr:objects/pr:act/">
<entry>
<per_type_crm_de>
<xsl:value-of select="pr:act_type_crm/pr:act_type_crm/pr:_standard/pr:de-DE"/>
</per_type_crm_de>
<per_type_crm_en>
<xsl:value-of select="pr:act_type_crm/pr:act_type_crm/pr:_standard/pr:en-US"/>
</per_type_crm_en>
<per_type_crm_it>
<xsl:value-of select="pr:act_type_crm/pr:act_type_crm/pr:_standard/pr:it-IT"/>
</per_type_crm_it>
<per_type_crm_fr>
<xsl:value-of select="pr:act_type_crm/pr:act_type_crm/pr:_standard/pr:fr-FR"/>
</per_type_crm_fr>
<per_uuid>
<xsl:value-of select="pr:_uuid"/>
</per_uuid>
<per_nc_name>
<xsl:value-of select="pr:act_nc_name"/>
</per_nc_name>
</entry>
</xsl:template>
<xsl:template match="pr:objects/pr:act">
<entry>
<grp_system_object_id>
<xsl:value-of select="pr:_system_object_id"/>
</grp_system_object_id>
<grp_last_modified>
<xsl:value-of select="pr:act_last_modified"/>
</grp_last_modified>
<_uuid>
<xsl:value-of select="pr:_uuid"/>
</_uuid>
<grp_nc_name>
<xsl:value-of select="pr:act_nc_name"/>
</grp_nc_name>
<grp_nc_name_lang_akronym>
<xsl:value-of select="pr:act_nc_name_lang/pr:generic_lang/pr:generic_lang_akronym"/>
</grp_nc_name_lang_akronym>
</entry>
</xsl:template>
As result I'm having that the xml refers to the 1st template match are correctly parsed and categorized, the xml that refers to the 2nd template are not parsed at all.
How can I deal with this problem? By using the element structure id
(below) which is different between the two categories as second match options could solve the problem?
<per_uuid>
<xsl:value-of select="pr:_uuid"/>
</per_uuid>
If so, how can I define multiple match options?
Regards
Hard to really grasp what you are trying to do without seeing your input data, but I am guessing you want to distinguish your two templates like this :
<xsl:template match="pr:objects/pr:act[pr:_uuid='someValue1']">
...
</xsl:template>
and
<xsl:template match="pr:objects/pr:act[pr:_uuid='someValue2']">
...
</xsl:template>