Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Two things that you need to adjust:</p> <ol> <li><p>The path for the <code>document()</code> needs to be the value of the filter variable. You are currently passing the string "$filter". You need to change <code>&lt;xsl:variable name="filter" select="document('$filter_xml')" /&gt;</code> to <code>&lt;xsl:variable name="filter" select="document($filter_xml)" /&gt;</code></p></li> <li><p>The <code>contains()</code> function expects string inputs for each of the parameters. In order to evaluate the <code>contains()</code> test against each of the filter's <code>EAN</code>, perform the test inside of a predicate filter on the <code>EAN</code> elements. For example, change: <code>&lt;xsl:when test="index-of(($filter/Filtre/Bloc5/Part1/EAN), ./server)"&gt;</code> to <code>&lt;xsl:when test="$filter/Filtre/Bloc5/Part1/EAN[contains(., ./server)]"&gt;</code>. If anything matches, the result will be at least one <code>EAC</code>, which will evaluate to <code>true()</code> in the test.</p></li> </ol> <p>Applied to an example XSLT:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:output indent="yes"/&gt; &lt;xsl:param name="filter_xml" /&gt; &lt;xsl:variable name="filter" select="document($filter_xml)" /&gt; &lt;xsl:template match="/"&gt; &lt;xsl:for-each select="root/item"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="$filter/Filtre/Bloc5/Part1/EAN[contains(., ./server)]"&gt; &lt;item&gt; &lt;server&gt;MAIN&lt;/server&gt; &lt;status&gt;PRODUCTION&lt;/status&gt; &lt;/item&gt; &lt;/xsl:when&gt; &lt;xsl:when test="$filter/Filtre/Bloc5/Part2/EAN[contains(., ./server)]" &gt; &lt;item&gt; &lt;server&gt;BACKUP&lt;/server&gt; &lt;status&gt;STOPPED&lt;/status&gt; &lt;/item&gt; &lt;/xsl:when &gt; &lt;xsl:otherwise&gt; &lt;item&gt; &lt;name&gt;OFFLINE&lt;/name&gt; &lt;desc&gt;Production&lt;/desc&gt; &lt;/item&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:for-each&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload