0

Can we access a folder situated anywhere in our system using XSLT? I mean the path of the folder is not known. Actually I need to import a file which is in that folder. However I don't know its full path (path is different for different files). Need to find it in my system.

Exact Issue:

I am converting an XML file to HTML using XSLT. That XML file can be anywhere on the system. And I need to import a CSS file for it which is kept in a folder named myCSS. Now this myCSS Folder is within a package which can be anywhere on the system. I just need to find that directory path which has the myCSS folder with my CSS file so that it links to my HTML file.

GTM
  • 37
  • 5
  • You can access any file -- but obviously *you* need to know where it is in the first place. If you don't know that and you don't know how to find it, then there is nothing XSLT can do for you. – Jongware Feb 24 '14 at 09:59
  • I just thought there may be some way to do this. To find a folder in the system using xslt – GTM Feb 24 '14 at 10:02
  • 1
    XSLT is not a 'general' Swiss Army Knife. There are other tools to find files; use one of those, then pass the file name as a parameter into your XSLT. – Jongware Feb 24 '14 at 10:06
  • Swiss Army Knife! Ok.. – GTM Feb 24 '14 at 10:08

1 Answers1

0

You can use document() function to select nodes etc from external XML files.

Problem is that you do need the full path to your external XML file to use this function. Isn't there any way to discover the full path?

For example, can you define the full path using:

  1. Nodes from the source XML?
  2. Pass parameters/variables to your XSLT from the external code? See solution in Java: XSL Transformation in Java with parameters
Community
  • 1
  • 1
Mark Veenstra
  • 4,691
  • 6
  • 35
  • 66
  • I have put down the exact issue in my question now.. And I need to do this with my XSLT. – GTM Feb 24 '14 at 09:52