XML/XSL Portal

Multiple Stylesheet Aware
HideXML TutorialHide

***Under construction*** Change CSS Property XSLT

This is an importable XSLT stylesheet that will allow you to change a css property in an XML style attribute. Usualy this isn't needed but if you are working with SVG or XHTML then it might be usefull. It is in the zip changecssproperty.xslt

You can use it by importing it into any stylesheet

<xsl:import href="changecssproperty.xslt" />

and then calling one of it's 2 methods

<xsl:template match="polyline">


  <xsl:apply-templates select="@*[name() != 'style']"/>

  <xsl:attribute name="style">

   <xsl:call-template name="changecssproperty">

    <xsl:with-param name="style" select="@style" />

    <xsl:with-param name="cssproperty">stroke:red</xsl:with-param>



  <xsl:apply-templates select="node()"/>




<xsl:template match="text">

 <xsl:call-template name="changecsspropertyandcopy">

  <xsl:with-param name="cssproperty">font-size:20</xsl:with-param>



The zip contains a stylesheet that shows a couple of ways of using it changecsspropmain.xsl and an SVG document to use it on shapes-polyline-BE-06.svg

saxon -o test1.svg shapes-polyline-BE-06.svg changecsspropmain.xsl


cscript xmltohtml.js shapes-polyline-BE-06.svg changecsspropmain.xsl test1.svg

The zip contains the msxml2 result changecsspropertyresult.svg and source changecsspropertyresult.svg_

Get the SVG test suite at http://www.w3.org/Graphics/SVG/Test/

Download the zip archive.



View XML
View XSL