0

I need to read XSL uri from XML file like this:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xsl_uri"?>
<Document>
         ...
</Document>

I am using org.w3c.dom.Document. Is there any way to get that uri?

  • take a look : http://stackoverflow.com/questions/4138754/getting-an-attribute-value-in-xml-element – Asraful Nov 04 '13 at 09:14

1 Answers1

3

There's no DOM method to do it: you'll have to read the processing instruction as text, and parse the pseudo-attributes within the processing instruction "by hand".

However, depending on why you want the information and what you want to do with it, you may be able to use

TransformerFactory.getAssociatedStylesheet()
Michael Kay
  • 156,231
  • 11
  • 92
  • 164