我有这个恼人的问题。我正在尝试提取属性的值,但不知何故出现了其他角色。
<Objs> <Obj RefId="0"> <TN RefId="0"> <T>System.Data.DataRow</T> <T>System.Object</T> </TN> <ToString>System.Data.DataRow</ToString> <Props> <I32 N="Counter">1</I32> <S N="DoctorInCharge">Williams Pete</S> <I32 N="Sorting">2</I32> </Props> </Obj> <Obj RefId="1"> <TNRef RefId="0" /> <ToString>System.Data.DataRow</ToString> <Props> <I32 N="Counter">2</I32> <S N="DoctorInCharge">Smith Patricia</S> <I32 N="Sorting">3</I32> </Props> </Obj> <Obj RefId="2"> <TNRef RefId="0" /> <ToString>System.Data.DataRow</ToString> <Props> <I32 N="Counter">3</I32> <S N="DoctorInCharge">Lee Sung</S> <I32 N="Sorting">4</I32> </Props> </Obj> <Obj RefId="3"> <TNRef RefId="0" /> <ToString>System.Data.DataRow</ToString> <Props> <I32 N="Counter">4</I32> <S N="DoctorInCharge">Pittman James</S> <I32 N="Sorting">5</I32> </Props> </Obj>
当我尝试这个样式表时:
><xsl:template match="Objs">
> <html>
> <body>
> <img width="400" height="100" src="icon.png" class="CalloutRightPhoto"/>
> <h1>CytostaticaReg - DoctorInCharge</h1>
> <table border="1">
> <tr bgcolor="#9acd32">
> <th>Element name</th>
> <th>Contence</th>
> </tr>
> <tr bgcolor="#FBF5A4">
> <th>Doctor in charge</th>
> </tr>
> <xsl:for-each select="Obj">
> <tr bgcolor="#ff0000">
> <td><xsl:value-of select='@RefId'/>" /></td>
> </tr>
> </xsl:for-each>
> </table>
> </body>
> </html>
></xsl:template>
所有选择的“RefID”值将在浏览器中显示为:
0“/&gt;
1“/&gt;
2“/&gt;
3“/&gt;
....但我真的想删除'“/&gt;”这样它将显示为:
0
1
2
3
怎么可以这样做?
非常感谢您的贡献: - )
/保
答案 0 :(得分:0)
比较原作:
<td><xsl:value-of select='@RefId'/>" /></td>
正确的:
<td><xsl:value-of select='@RefId'/></td>