I have an xml like the following:
<!-- XML-Code -->
indoc := '
<Students>
<Student Enrolled = "true">
<SID>12456</SID>
</Student>
<Student Enrolled = "false">
<SID>12345</SID>
</Student>
</Students>';
<!-- XML Code -->
indomdoc := dbms_xmldom.newDomDocument(indoc);
I am using
dbms_xsl开发者_开发百科processor.selectNodes(dbms_xmldom.makeNode(indomdoc),
'//Student[@Enrolled="True"]');
This is returning me the values Of Students with attribute Enrolled as true.
and again I am using
dbms_xslprocessor.selectNodes(dbms_xmldom.makeNode(indomdoc),
'//Student[@Enrolled="False"]');
to get all students who are not enrolled yet.
But I want to know is there any way to find the value of enrolled attribute using xsl processor, rather than directly giving like @Enrolled="True"
and @Enrolled="False"
.
XPath expression //Student/@Enrolled
will give you all the values of the Enrolled
attribute.
How about using an XPath expression referencing the attribute value?
fn:data(//Student/@Enrolled)
Am I missing some part of your problem?
精彩评论