Creating
\--stringparam username jdoe --stringparam password 'foo > bar' ./authentication.xslt - <<< '<x/>' \```
xsltproc
can also help with creating XML files from scratch, and take care of escaping and formatting easily. To do this we start with a parametric XSLT file:
1
<?xml version="1.0"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
<xsl:output indent="yes"/>
4
<xsl:param name="username"/>
5
<xsl:param name="password"/>
6
<xsl:template match="/">
7
<authentication>
8
<username>
9
<xsl:value-of select="$username"/>
10
</username>
11
<password>
12
<xsl:value-of select="$password"/>
13
</password>
14
</authentication>
15
</xsl:template>
16
</xsl:stylesheet>
This page is a preview of The newline Guide to Bash Scripting