2017-02-09 18 views
0

XML文件在XSLT

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet type="text/xsl" href="2c.xsl"?> 
<offers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="2c.xsd"> 
    <product name="apples" xsi:type="ct_fruit_planttype"> 
     <harvest>May</harvest> 
     <price>27.90</price> 
     <supplier>Company2</supplier> 
     <stone>true</stone> 
    </product> 
</offers> 

如何讓繼承屬性值我怎樣才能得到xsi:type屬性值。

這不起作用<xsl:value-of select="@type" />

任何建議請。

+0

從什麼情況? –

+0

我得到這樣的名稱屬性''的值。是否有可能獲得xsi:type值? –

回答

1

如果 - 因爲它似乎 - 你是在product的背景下,你可以使用:

<xsl:value-of select="@xsi:type" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> 

得到ct_fruit_planttype


請注意,您可以移動空間聲明到根xsl:stylesheet元素,以從輸出抑制其添加exclude-result-prefixes="xsi"