给我举个例子如何更改这个xml?在xslt html中?
<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>
我想要这样的结果
-procedure
-View
-Supine
-one check box After that one text box
-Upright
-one check box After that one text box
给我一些引导线
我想得到这样的html输出,我的xml中有很多定义,但名称正在更改
<table>
<tr>
<td>
procedure
</td>
</tr>
<tr>
<td>
View
</td>
</tr>
checkbox
Supine
textbox
<tr>
<td>
checkbox
Upright
textbox
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
这可能是您所需要的:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="define/element">
- <xsl:value-of select="@name"/>
<xsl:for-each select="element/optional/element">
<input type="checkbox" name="{@name}"/> <xsl:value-of select="@name"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>