ditafileset/jobmapper: Process just SVG files? #4697
-
|
I need to apply a filter to SVG files to move CSS rules to onto the elements that reference them so that SVGs that get inlined on the server will not interfere with each other on a page. Using this code: I get the list of all images. What I'm going for is getting just the SVGs so that I can then apply an XSLT to each one. I'm not seeing a way to do that here. Is it possible, and if so, how do I do it? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
Your question is how to select .svg files from you |
Beta Was this translation helpful? Give feedback.
-
|
As far as I can tell, would only apply to the resource selection done by , but it doesn't support nested and there doesn't appear to be a way to filter the list after the fact. Here's the code I'm using to apply an XSLT to the images: This works, in that the XSLT gets run against each file--I've verified that it's using the XSL specified--but I'm not seeing the output I expect (meaning the changes created by the XSLT are not reflected in output). So something with the OT pipeline XSLT target is not working as expected (it's unlikely that my XSLT is written so that it doesn't actually produce any output). I suspect I just need to use normal Ant processing using against the output directory, but that will require putting the output to a temp location and then copy the resulting SVGs back to the output, which is doable but I was hoping there was a more direct way using and the built-in task. |
Beta Was this translation helpful? Give feedback.
-
|
I added the copying of the SVGs to the temp dir, and with that then I could easily apply the XSLT to them: My XSLT makes the CSS class names unique using the SVG filename as a prefix: This all seems to work as intended. |
Beta Was this translation helpful? Give feedback.
-
|
Replace <ditafileset format="image"/>with <restrict>
<name name="*.svg"/>
<ditafileset format="image"/>
</restrict>To first select all images from DITA-OT job configuration and then restrict the fileset to only SVG files by file extension. |
Beta Was this translation helpful? Give feedback.
I added the copying of the SVGs to the temp dir, and with that then I could easily apply the XSLT to them: