2015-06-05 27 views
-2

我有这个烦人的问题。我试图提取属性的值,但不知何故附加角色出现。另一个XSLT东西

<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" />
1“/>
2”/>
3" />

....但我真的想去掉 '” />',这样它会显示为:

0 
1 
2 
3 

怎么能这样做?

非常感谢你的贡献:-)

/保罗

+0

'​​的“/>',这条线有什么问题?你没有看到第问题......? –

+0

请给你的问题一个标题,描述问题是什么。 –

回答

0

比较原始的:

<td><xsl:value-of select='@RefId'/>" /></td> 

与正确的:

<td><xsl:value-of select='@RefId'/></td>