F
FC
Hello folks,
I was wondering if there any other method of achieving the following:
I have a XSL transformation outputting a SVG document.
For reasons too long to explain here, I must embed a CSS style sheet inside
a <style> element in the SVG output document using a CDATA block.
The CSS stylesheet is not an xml document, therefore I cannot open it using
the document function (I suppose, I didn't even try frankly).
In order to work around the problem, I created a "parallel" xml version of
the CSS stylesheet, just embedding everything within a <css> element, plus
the usual xml header.
In this fashion I can open it with document and extract the text node
belonging to <css> and copy it to the output document.
This rather cumbersome method forces me to re-create the fake css every time
I modify the real stylesheet, so I was just asking myself if it is a
by-product of too many late hours or just an honest solution.
Here is the code:
<xsl:if test="$embed=1">
<style type="text/css">
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:value-of select="document(concat($css,'.xml'))/css/text()"/>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</style>
</xsl:if>
Thanks for your advice,
Flavio
I was wondering if there any other method of achieving the following:
I have a XSL transformation outputting a SVG document.
For reasons too long to explain here, I must embed a CSS style sheet inside
a <style> element in the SVG output document using a CDATA block.
The CSS stylesheet is not an xml document, therefore I cannot open it using
the document function (I suppose, I didn't even try frankly).
In order to work around the problem, I created a "parallel" xml version of
the CSS stylesheet, just embedding everything within a <css> element, plus
the usual xml header.
In this fashion I can open it with document and extract the text node
belonging to <css> and copy it to the output document.
This rather cumbersome method forces me to re-create the fake css every time
I modify the real stylesheet, so I was just asking myself if it is a
by-product of too many late hours or just an honest solution.
Here is the code:
<xsl:if test="$embed=1">
<style type="text/css">
<xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text>
<xsl:value-of select="document(concat($css,'.xml'))/css/text()"/>
<xsl:text disable-output-escaping="yes">]]></xsl:text>
</style>
</xsl:if>
Thanks for your advice,
Flavio