dimanche 20 novembre 2016

XSL: Summarize if-Condition

I would like to summarize parts of my if-condition which could appear multiple times (and in different conditions) in my source file. For example:

<xsl:if test="
  preceding-sibling::node()[
  (local-name()='a' and @attr1='a1') or
  (local-name()='b' and @attr2='b1')
  ] or
  following-sibling::node()[
  (local-name()='a' and @attr1='a1') or
  (local-name()='b' and @attr2='b1')
  ]
">
...
</xsl:if>

As you can see the inner condition (local-name()...) is the same but the nodes may be different.

Aucun commentaire:

Enregistrer un commentaire