Michał Sokołowski
Michał Sokołowski

Reputation: 336

Read xsl uri from xml file

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?

Upvotes: 0

Views: 211

Answers (1)

Michael Kay
Michael Kay

Reputation: 163595

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()

Upvotes: 3

Related Questions