Xml 如何在XSLT中获取继承的属性值

Xml 如何在XSLT中获取继承的属性值,xml,xslt,Xml,Xslt,xml文件 <?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="appl

xml文件

    <?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>

五月
27.90
公司2
真的
如何获取
xsi:type
属性值

这不起作用


请提供任何建议。

如果您处于
产品的上下文中,您可以使用:

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

要获取
ct\u fruit\u planttype



请注意,您可以将名称空间声明向上移动到根
xsl:stylesheet
元素,并添加
exclude result prefixes=“xsi”
,以便从输出中抑制它。

从什么上下文中?我得到name属性的值
。是否可以获取xsi:type值?