schematron,多元素值比较

时间:2015-06-01 10:43:50

标签: schematron

在schematron我有2个文件。在source01.xml中有一个keyvalue(xacml-context:AttributeValue),我希望通过比较keyvalue的值和" eh:ServiceProviderID&#的值来获得source02.xml中servicelevel的最小值。 34;在source02.xml。

在以下示例中,我想得到" 2"结果。

source01.xml

<xacml-context:Resource>
<xacml-context:Attribute AttributeId="urn:etoegang:core:ServiceID" DataType="http://www.w3.org/2001/XMLSchema#string">
    <xacml-context:AttributeValue>01002</xacml-context:AttributeValue>
</xacml-context:Attribute>
<xacml-context:Attribute AttributeId="urn:etoegang:core:ServiceUUID" DataType="http://www.w3.org/2001/XMLSchema#string">
    <xacml-context:AttributeValue>    
</xacml-context:AttributeValue>

source02.xml

    <eh:ServiceProvider>        
    <eh:ServiceProviderID>01001</eh:ServiceProviderID>  
    <eh:OrganizationDisplayName>company A</eh:OrganizationDisplayName>   
    <eh:Service>    
        <eh:ServiceID>DV:01506</eh:ServiceID>
        <eh:ServiceLevel>1</eh:ServiceID>
        ...
    </eh:Service>
    <eh:Service>    
        <eh:ServiceID>DV:02506</eh:ServiceID>
        <eh:ServiceLevel>2</eh:ServiceID>
        ...
    </eh:Service>
    <eh:Service>    
        <eh:ServiceID>DV:03506</eh:ServiceID>
        <eh:ServiceLevel>3</eh:ServiceID>
        ...
    </eh:Service>
</eh:ServiceProvider>

<eh:ServiceProvider>        
    <eh:ServiceProviderID>01002</eh:ServiceProviderID>  
    <eh:OrganizationDisplayName>company B</eh:OrganizationDisplayName>  
    <eh:Service>    
        <eh:ServiceID>DV:01507</eh:ServiceID>
        <eh:ServiceLevel>2</eh:ServiceID>
        ...
    </eh:Service>
    <eh:Service>    
        <eh:ServiceID>DV:02507</eh:ServiceID>
        <eh:ServiceLevel>2+</eh:ServiceID>
        ...
    </eh:Service>
    <eh:Service>    
        <eh:ServiceID>DV:03507</eh:ServiceID>
        <eh:ServiceLevel>3</eh:ServiceID>
        ...
    </eh:Service>
</eh:ServiceProvider>

<eh:ServiceProvider>        
    <eh:ServiceProviderID>01003</eh:ServiceProviderID>  
    <eh:OrganizationDisplayName>company C</eh:OrganizationDisplayName>  
    <eh:Service>    
        <eh:ServiceID>DV:02508</eh:ServiceID>
        <eh:ServiceLevel>1</eh:ServiceID>
        ...
    </eh:Service>
    <eh:Service>    
        <eh:ServiceID>DV:03508</eh:ServiceID>
        <eh:ServiceLevel>3</eh:ServiceID>
        ...
    </eh:Service>
</eh:ServiceProvider>

的Schematron

<rule context="xacml-c:Attribute[@AttributeId='urn:etoegang:core:ServiceID']">
        <let name="ServiceIdValue" value="xacml-c:AttributeValue"/>
        <assert test="$ServiceIdValue=' '">ServiceID (<value-of select="$ServiceIdValue"/>) is the keyvalue.</assert>
        <let name="DCValue" value="document('source02.xml')//*[name()='eh:ServiceProviderID']"/>
        <assert test="$DCValue=' '">DCValue (<value-of select="$DCValue"/>) is the source02 value. </assert>
    </rule>

0 个答案:

没有答案