my input xml file looks like
<root>
<sub>
<element1 value="abc"/>
<element2 value="123"/>
</sub>
<sub1>
<element1 value="ert"/>
<element2 value="abc"/>
</sub1>
</root>
i need an XSLT function which reads below XML file and pulls the xpath expression value specified at map/domain/instance/@xpath from above file
<map>
<domain>
<instance xpath="root/sub/element1/@value" length="2"/>
</domain>
<domain>
<instance xpath="root/sub1/element2/@value" length="3"/>
</domain>
</map>
I need a xslt function which checks the length specified for each xpath expression against the incoming xml file.
if it fails on length it should retrun false.
This XSLT 1.0 stylesheet:
Output:
Edit: XSLT 2.0 solution. This stylesheet:
Output:
Edit 2: A bit improven. So now, with this input:
Output: