VKP
VKP

Reputation: 658

How to refer CSS in XSLT using relative path

Hi i am trying to refer CSS from my XSL 2.0 File . My Code in 00BatchLevelStylesheet.xsl to refer css and JS as below but its not refer those files under ss and scripts folders . I am running a spring boot application. I am not getting any error but its not referring the css inside that folders . If i hardcode the path its applying the styles. What is the mistake i am doing .

Java Call

String xsl= "Main_Stylesheets\\00BatchLevelStylesheet.xsl";
TransformerFactory transformerFactory = 
TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(new 
javax.xml.transform.stream.StreamSource(xsl));
transformer.transform (new 
javax.xml.transform.stream.StreamSource("sample.xml"), new 
javax.xml.transform.stream.StreamResult
      (new FileOutputStream("sampleresult.html"))); 

Reference in XSL

<link rel="stylesheet" href="ss/jquery-ui_1-11-2.css"/>

enter image description here

Upvotes: 0

Views: 82

Answers (1)

Michael Kay
Michael Kay

Reputation: 163262

Perhaps those links are relative to the XSLT stylesheet rather than the HTML page? You really haven't given enough information to solve this one - we need a lot more context. Are you running XSLT 1.0 in the browser, and how is the stylesheet being invoked?

Upvotes: 1

Related Questions