0

How do i perform an inclusion based on an if statement. I tried looking around and could not find much relevant information. Please look at the if statements below

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" omit-xml-declaration="yes" doctype-system="about:legacy-compat" />
<xsl:include href="../xsl/ads.xsl" />
<xsl:include href="../xsl/templates.xsl" />
<xsl:include href="../xsl/pagemenu.xsl" />
<xsl:include href="templates_jobs.xsl" />

<xsl:if test="/*/isperformer=1">
<xsl:include href="nd2.xsl" />
</xsl:if>

<xsl:if test="/*/isperformer=0">
<xsl:include href="nd1.xsl" />
</xsl:if>

</xsl:stylesheet>
somejkuser
  • 8,856
  • 20
  • 64
  • 130
  • `` are not allowed at top-level. Unfortunately it's not possible to perform "conditional" includes the way you indicate. Question: how do you launch your transformation? With Java code? – potame Nov 17 '16 at 17:00
  • Wrong way to go. What is inside "nd1.xsl" and "nd2.xsl"? ``and `` must be at top-level. – uL1 Nov 17 '16 at 17:01
  • 1
    Additionally to the alternatives in the duplicate question you could simply combine `nd1.xsl` and `nd2.xsl` into one and make their templates react differently, depending on the `isperformer` value. – Tomalak Nov 17 '16 at 17:04

0 Answers0