我正在使用 CCD XML 文档,它包含如下数据:
<tr ID="encounter17" >
<td>09/18/2012</td>
<td ID="type41">Office Visit</td>
<td>Family Practice</td>
<td>
<paragraph>REDACTED</paragraph>
</td>
<td />
</tr>
<tr ID="encounter18" styleCode="altRow">
<td>09/17/2012</td>
<td ID="type42">Office Visit</td>
<td>Family Practice</td>
<td>
<paragraph>REDACTED</paragraph>
</td>
<td />
</tr>
我正在尝试使用“标准”CCD.xsl 将其呈现为 HTML,Derived from HL7 Finland R2 Tyylitiedosto: Tyyli_R2_B3_01.xslt
Updated by Calvin E. Beebe, Mayo Clinic - Rochester Mn.
带有 IDencounter17
的元素会渲染,带有 ID 的元素encounter18
不会渲染。查看输出xsltproc
是因为 XSLT 无法识别该styleCode
属性。仅Bold, Italic, Underline
受支持。
如何更改此 XSLT 以使其容忍未知的 styleCode?
<!-- Stylecode processing
Supports Bold, Underline and Italics display-->
<xsl:template match="//n1:*[@styleCode]">
<xsl:if test="@styleCode='Bold'">
<xsl:element name='b'>
<xsl:apply-templates/>
</xsl:element>
</xsl:if>
<xsl:if test="@styleCode='Italics'">
<xsl:element name='i'>
<xsl:apply-templates/>
</xsl:element>
</xsl:if>
<xsl:if test="@styleCode='Underline'">
<xsl:element name='u'>
<xsl:apply-templates/>
</xsl:element>
</xsl:if>
<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Italics') and not (contains(@styleCode, 'Underline'))">
<xsl:element name='b'>
<xsl:element name='i'>
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="contains(@styleCode,'Bold') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Italics'))">
<xsl:element name='b'>
<xsl:element name='u'>
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and not (contains(@styleCode, 'Bold'))">
<xsl:element name='i'>
<xsl:element name='u'>
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:if>
<xsl:if test="contains(@styleCode,'Italics') and contains(@styleCode,'Underline') and contains(@styleCode, 'Bold')">
<xsl:element name='b'>
<xsl:element name='i'>
<xsl:element name='u'>
<xsl:apply-templates/>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:if>
我已经尝试添加:
<xsl:if test="not (contains(@styleCode,'Italics')) and not (contains(@styleCode,'Underline')) and not (contains(@styleCode, 'Bold'))">
<xsl:apply-templates/>
</xsl:if>
这似乎只是呈现元素,它不会“落入”处理<tr>
标签的 XSLT 部分。