Note that there are some explanatory texts on larger screens.

plurals
  1. POTesting if XML element exists in XSLT
    text
    copied!<p>This is probably a really easy answer, but for the life of me I can't figure it out.</p> <p>I want to display certain content depending on which child element is being displayed but I don't know how to test for the element I want. I want to see if the start, stop, and note elements exist</p> <pre><code>&lt;xsl:template match="protocol[@id=$protocolNumber]"&gt; &lt;h4&gt;&lt;xsl:value-of select="$sectionNumber"/&gt;.&lt;xsl:value-of select="@id"/&gt;&amp;nbsp;&lt;xsl:value-of select="@title"/&gt;&lt;/h4&gt; &lt;p&gt; &lt;xsl:for-each select="child::*"&gt; &lt;xsl:choose&gt; &lt;xsl:when test="start"&gt; &lt;span id="start"&gt;&lt;xsl:value-of select="start[@level]" /&gt;&lt;/span&gt; &lt;/xsl:when&gt; &lt;xsl:when test="stop"&gt; &lt;span id="stop"&gt;&lt;xsl:value-of select="stop[@level]" /&gt;&lt;/span&gt; &lt;/xsl:when&gt; &lt;xsl:when test="note"&gt; &lt;span id="note"&gt;&lt;xsl:value-of select="note[@title]" /&gt;:&amp;nbsp;&lt;xsl:value-of select="note/text()" /&gt;&lt;/span&gt; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; &lt;xsl:value-of select="text()"/&gt;&lt;br/&gt; &lt;/xsl:otherwise&gt; &lt;/xsl:choose&gt; &lt;/xsl:for-each&gt; &lt;/p&gt; </code></pre> <p></p> <pre><code>&lt;protocol id="2" title="Post-Conversion Of VF / VT"&gt; &lt;note title="criteria"&gt;Post-conversion treatment of VF or VT should only be started if the patient has regained a pulse of adequate rate, and has a supraventricular rhythm. If not, refer to other cardiac protocols as appropriate. All antiarrhythmics are contraindicated if ventricular escape rhythm is present.&lt;/note&gt; &lt;start level="All Levels"/&gt; &lt;step&gt;Routine medical care.&lt;/step&gt; &lt;stop level="EMT"/&gt; &lt;stop level="EMT-I"/&gt; &lt;start level="EMT-CC &amp;amp; P"/&gt; &lt;step&gt; If conversion results from defibrillation without any drug therapy:&lt;br/&gt;&lt;br/&gt; Amiodarone (Cordarone) 150 mg IV/IO Slow IV &lt;/step&gt; &lt;step&gt;If Amiodarone was the drug resulting in conversion from VF/VT, no additional antiarrhythmic is required.&lt;/step&gt; &lt;step&gt; If Lidocaine (Xylocaine) was the drug resulting in conversion from VF/VT:&lt;br/&gt;&lt;br/&gt; Repeat Lidocaine bolus 0.75 mg/kg IV/IO every 10 minutes up to a total cumulative dose of 3 mg/kg. &lt;/step&gt; &lt;step&gt;If more than above listed doses are needed because of length of transport time, contact Medical Control.&lt;/step&gt; &lt;/protocol&gt; </code></pre>
 

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