Xml 如何在xPath中检查类型是否等于类型或是否派生自类型

Xml 如何在xPath中检查类型是否等于类型或是否派生自类型,xml,xpath,xsd,schematron,Xml,Xpath,Xsd,Schematron,我正在Schematron中使用xPath。我能够检查类型是否等于目标类型。例如“xsd:string eq xsd:string” <sch:rule context="uis:variable/uis:dependency/uis:length"> <sch:assert test="**../../@type eq 'xsd:string'**"> Text </sch:assert>

我正在Schematron中使用xPath。我能够检查类型是否等于目标类型。例如“xsd:string eq xsd:string”

<sch:rule context="uis:variable/uis:dependency/uis:length">
<sch:assert test="**../../@type eq 'xsd:string'**">      
Text        
</sch:assert>                       
</sch:rule>

正文
如何检查用户定义的类型是否为从xsd:string派生的类型?我试过:

<sch:rule context="uis:variable/uis:dependency/uis:length">
<sch:assert test="**../../@type instance of attribute (*,xsd:string)**">
Text        
</sch:assert>                       
</sch:rule>

正文

但是它不起作用。

没有公开的XPath 2.0功能。事实上,XPath2.0类型不是一流的值;无法从仅在运行时已知的名称中查找类型,也无法请求该类型的属性。您需要使用扩展:Xerces和Saxon都有用于查询模式组件的API,您可以构造调用这些组件的Java扩展函数。

谢谢Michael,我将看看您的建议。