This is my xml code:
<define name="Procedure">
<element name="Procedure" radlex:id="RID1559" radlex:match="Exact">
<element name="View" radlex:id="RID10420" radlex:match="Exact">
<optional>
<element name="Supine" radlex:id="RID10421" radlex:match="Exact" snomed:id="416733000">
<empty/>
</element>
</optional>
<optional>
<element name="Upright" radlex:id="RID10455" radlex:match="Exact">
<empty/>
</element>
</optional>
<text/>
</element>
<text/>
</element>
</define>
I have written my XSLT code like this. Is this the correct way to write my code? Is this the correct way to use the if condition in XSLT?
Is it possible to code it like this:
Is it possible to read all tags (like element
,optional
,empty
) by using a for each
loop?
And if it is optional, then I want it to create a check box in HTML; I would like it to do it for all of them.
<xsl:template match="rng:define">
<table>
<xsl:for-each select="rng:element[@name='Procedure']">
<span style="color:blue;">
<tr>
<td>
<xsl:text> Procedure </xsl:text>
</td>
</tr>
<xsl:if test="rng:element > (rad:id='RID10420')">
<tr>
<td>
<xsl:text> View </xsl:text>
</td>
</tr>
<tr>
<td>
<input type="text" name="View"></input>
</td>
</tr>
</xsl:if>
<xsl:if test="rng:element/rng:optional > (rad:id='RID10421')">
<tr>
<td>
<input text="Supine" name="cSupine" type="checkbox" class="checkbox" id="cSupine" value="checkbox"/>
<xsl:text> Supine </xsl:text>
</td>
</tr>
</xsl:if>
<xsl:if test="rng:element/rng:optional > (rad:id='RID10455')">
<tr>
<td>
<input text="Upright" name="cUpright" type="checkbox" class="checkbox" id="cUpright" value="checkbox"/>
<xsl:text> Upright </xsl:text>
</td>
</tr>
</xsl:if>
</span>
</xsl:for-each>
</table>
</xsl:template>