Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7458309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:25:51+00:00 2026-05-29T13:25:51+00:00

I’ve been swapping out connectionstrings wholesale wtih xlst for a while thusly <xsl:template match=/configuration/connectionStrings/add[@name=’SybaseDB’]/@connectionString

  • 0

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-

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T13:25:52+00:00Added an answer on May 29, 2026 at 1:25 pm

    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-password template at the bottom.

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:exsl="http://exslt.org/common"
        exclude-result-prefixes="xs exsl"
        version="1.0">
    
        <xsl:output method="xml" indent="yes"/>
    
        <xsl:variable name="target-name">SybaseDB</xsl:variable>
        <xsl:variable name="new-password">NEWPASSWORD</xsl:variable>
    
        <xsl:template match="@*|*|text()">
            <xsl:copy>
                <xsl:apply-templates select="@*|*|text()"/>
            </xsl:copy>
        </xsl:template>
    
        <xsl:template match="/configuration/connectionStrings/add">
            <xsl:choose>
                <xsl:when test="@name=$target-name">
                    <xsl:variable name="items">
                        <xsl:call-template name="parse-connetion-string">
                            <xsl:with-param name="text" select="@connectionString"/>
                        </xsl:call-template>
                    </xsl:variable>
    
                    <xsl:variable name="items-new-password">
                        <xsl:apply-templates mode="change-password" select="exsl:node-set($items)"/>
                    </xsl:variable>
    
                    <xsl:copy>
                        <xsl:copy-of select="@*"/>
                        <xsl:attribute name="connectionString">
                            <xsl:apply-templates mode="generate-connection-string" select="exsl:node-set($items-new-password)"/>
                        </xsl:attribute>
                    </xsl:copy>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:copy-of select="."/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    
        <xsl:template name="parse-connetion-string">
            <xsl:param name="text"/>
    
            <xsl:variable name="itemString">
                <xsl:choose>
                    <xsl:when test="contains($text,';')">
                        <xsl:value-of select="substring-before($text,';')"/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$text"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <xsl:variable name="itemName" select="substring-before($itemString,'=')"/>
            <xsl:variable name="itemValue" select="substring-after($itemString,'=')"/>
            <xsl:variable name="rest" select="substring-after($text,';')"/>
    
            <item name="{$itemName}" value="{$itemValue}"/>
    
            <xsl:if test="string-length($rest)!=0">
                <xsl:call-template name="parse-connetion-string">
                    <xsl:with-param name="text" select="$rest"/>
                </xsl:call-template>
            </xsl:if>
        </xsl:template>
    
        <xsl:template match="item" mode="generate-connection-string">
            <xsl:if test="position() != 1">;</xsl:if>
            <xsl:value-of select="@name"/>
            <xsl:text>=</xsl:text>
            <xsl:value-of select="@value"/>
        </xsl:template>
    
        <xsl:template match="item" mode="change-password">
            <xsl:choose>
                <xsl:when test="@name='Password'">
                    <item name="{@name}" value="'{$new-password}'"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:copy-of select="."/>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.