I’ve been swapping out connectionstrings wholesale wtih xlst for a while thusly
<xsl:template match="/configuration/connectionStrings/add[@name='SybaseDB']/@connectionString" >
<xsl:attribute name="connectionString">
<xsl:text>host='LeroyJenkins.org';Pooling=true;Port='5100';UID='LeroyJenkins';Password='12345';Database='LeroyJenkins';Min Pool Size=5;Load Balance Timeout=30;Max Pool Size=50;Connection Timeout=60000;Workstation ID='LeroyJenkins';Fetch Buffer Size=4096;Clone Connection If Needed=True</xsl:text>
</xsl:attribute>
</xsl:template>
But what if I want to modify just the
;Password='12345'
element to replace 12345 with a different value? Say “LeroyJenkins”…
How can I do this?
I found lots of posts on doing substring manipulation in xslt.. but I’m afraid I wasn’t able to figure out how to apply this to my situation.
I’m using this tool : TransformXml.exe from this article..
http://www.codeproject.com/Articles/16549/TransformXML-a-command-line-utility-to-apply-XSL-t
If someone could explain what’s going on so I can internalize & apply it, I’d greatly appreciate that.
Thanks,
Cal-
Somewhat more elaborate than just string manipulation. It transforms the connection string into an XML structure, replaces the password, and puts it back together. You should be able to replace other items, than just the password, by modifying the
change-passwordtemplate at the bottom.