[xslt] Pull request : xsltproc --fileparam



Salut Daniel, Hi Nick

I added a --fileparam switch to xsltproc command line to enable loading
file content as stylesheet parameter string literal. It also enhance
--stringparam as a side effect. I hope you'll find this useful.

Please find git repo to pull from here :
https://github.com/etisserant/libxslt

Usage case :

$ cat test.xml
<tag/>

$ cat test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:output method="xml"/>
  <xsl:param name="param"/>
  <xsl:param name="stringparam"/>
  <xsl:param name="fileparam"/>
  <xsl:template match="/">
    <param>
        <xsl:value-of select="$param"/>
    </param>
    <stringparam>
        <xsl:value-of select="$stringparam"/>
    </stringparam>
    <fileparam>
        <xsl:value-of select="$fileparam"/>
    </fileparam>
  </xsl:template>
</xsl:stylesheet>

$ cat test.txt
Hello World

$ xsltproc --param param "2+3" --stringparam stringparam "2+3"
--fileparam fileparam test.txt test.xsl test.xml
<?xml version="1.0"?>
<param>5</param><stringparam>2+3</stringparam><fileparam>Hello World
</fileparam>

Thanks for libxslt.

Edouard Tisserant.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]