James: Glad to hear you found a solution- Martin ----- Original Message ----- From: "James Hafer" <[EMAIL PROTECTED]> To: "Martin Gainty" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, May 20, 2004 3:53 PM Subject: RE: [Nant-users] Help with xmlpoke
In case anybody cares, I took a shortcut. I'm reminded of the scene in Indiana Jones where, facing a raging savage, Indy looks at the bullwhip he's holding in one hand, looks back at the assailant, then simply pulls his revolver with the other hand and shoots the guy. I've essentially done the same, by using 'exec' to run a series of simple sed operations on my target xsl files. GNU sed for windows can be had here: http://gnuwin32.sourceforge.net/packages/sed.htm Cheers! ~James -----Original Message----- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 8:29 AM To: James Hafer; [EMAIL PROTECTED] Subject: Re: [Nant-users] Help with xmlpoke >From what I know of the situation.. Its easier to write a quick and dirty utility which will iterate through all nodes of your System.XML.XMLDocument which meet the criteria via SelectNodes and returns back a System.Xml.XmlNodeList then effect your substitution with a foreach loop Here is an example courtesy of Microsoft- http://support.microsoft.com/default.aspx?scid=kb;en-us;318499 -Martin ----- Original Message ----- From: "James Hafer" <[EMAIL PROTECTED]> To: "Martin Gainty" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, May 19, 2004 8:52 AM Subject: RE: [Nant-users] Help with xmlpoke Hi Martin and Gert, I think that Gert's suggestion will resolve the xsl namespace prefix issue (I'll post upon success), but there's going to be another problem. Given that there are multiple items such as this in the target XSL file: <xsl:for-each select="References/Reference[contains(@refto, 'dbcore')]"> <Reference type = "Gac" refto = "dbcore, Version=1.0.1.29, Culture=neutral, PublicKeyToken=1403d50a7683ade0"/> </xsl:for-each> I need to be able to specify an xpath such as this in order to effect ONLY the target node (sorry for line-wrap): xpath="/xsl:transform/*/*/*/xsl:[EMAIL PROTECTED]'References/Reference[c ontains(@refto, 'dbcore')]']/[EMAIL PROTECTED]'Gac']/@refto" In other words, I somehow need to 'escape' the sequence [EMAIL PROTECTED]'References/Reference[contains(@refto, 'dbcore')]'] so that Nant's xpath function doesn't try to interpret it. ~James -----Original Message----- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 19, 2004 6:05 AM To: James Hafer; [EMAIL PROTECTED] Subject: RE: [Nant-users] Help with xmlpoke James- What happened after you followed up with Gert Dreisen's inserted namespace??? Regards, -Martin >From: "James Hafer" <[EMAIL PROTECTED]> >To: "Martin Gainty" ><[EMAIL PROTECTED]>,<[EMAIL PROTECTED]> >Subject: RE: [Nant-users] Help with xmlpoke >Date: Tue, 18 May 2004 20:31:11 -0600 >MIME-Version: 1.0 >Received: from mc3-f8.hotmail.com ([64.4.50.144]) by mc3-s6.hotmail.com >with Microsoft SMTPSVC(5.0.2195.6824); Tue, 18 May 2004 19:34:58 -0700 >Received: from sc8-sf-list2.sourceforge.net ([66.35.250.206]) by >mc3-f8.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Tue, 18 May 2004 >19:33:18 -0700 >Received: from localhost ([127.0.0.1] helo=projects.sourceforge.net)by >sc8-sf-list2.sourceforge.net with esmtp (Exim 4.30)id 1BQGsF-0000n1-1g; >Tue, 18 May 2004 19:32:03 -0700 >Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.12] >helo=sc8-sf-mx2.sourceforge.net)by sc8-sf-list2.sourceforge.net with esmtp >(Exim 4.30)id 1BQGrf-0000i4-S2for [EMAIL PROTECTED]; Tue, 18 >May 2004 19:31:27 -0700 >Received: from dens700.hotbank.com ([206.61.185.8] helo=mail.hotbank.com)by >sc8-sf-mx2.sourceforge.net with esmtp (Exim 4.30)id 1BQGrf-00040m-56for >[EMAIL PROTECTED]; Tue, 18 May 2004 19:31:27 -0700 >X-Message-Info: 820stLNiepQE9Hw69ZuUoQPLokyTcCY2AGN9Cx/ryPo= >X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 >content-class: urn:content-classes:message >Message-ID: <[EMAIL PROTECTED]> >X-MS-Has-Attach: yes >X-MS-TNEF-Correlator: Thread-Topic: [Nant-users] Help with xmlpoke >Thread-Index: AcQ9RGeG/XO5+uVhQhCwDuz+Xl0blAAAg1NQ >X-Spam-Score: 0.2 (/) >X-Spam-Report: Spam Filtering performed by sourceforge.net.See >http://spamassassin.org/tag/ for more details.Report problems to >http://sf.net/tracker/?func=add&group_id=1&atid=2000010.1 >HTML_FONTCOLOR_UNKNOWN BODY: HTML font color is unknown to us0.1 HTML_60_70 > BODY: Message is 60% to 70% HTML0.0 HTML_MESSAGE >BODY: HTML included in message >Errors-To: [EMAIL PROTECTED] >X-BeenThere: [EMAIL PROTECTED] >X-Mailman-Version: 2.0.9-sf.net >Precedence: bulk >List-Unsubscribe: ><https://lists.sourceforge.net/lists/listinfo/nant-users>,<mailto:nant- [EMAIL PROTECTED]> >List-Id: Discussion of NAnt features and usage ><nant-users.lists.sourceforge.net> >List-Post: <mailto:[EMAIL PROTECTED]> >List-Help: <mailto:[EMAIL PROTECTED]> >List-Subscribe: ><https://lists.sourceforge.net/lists/listinfo/nant-users>,<mailto:nant- [EMAIL PROTECTED]> >List-Archive: ><http://sourceforge.net/mailarchive/forum.php?forum=nant-users> >Return-Path: [EMAIL PROTECTED] >X-OriginalArrivalTime: 19 May 2004 02:33:21.0113 (UTC) >FILETIME=[A6A7AC90:01C43D49] > >I tried this: > > > > >xpath="/xsl:transform/*/*/*/xsl:for-each/[EMAIL PROTECTED]'Gac']/@refto" > > > >and got this error: > > > > > >BUILD FAILED > > > >E:\QABuildTree\ATM\is.build(215,10): > >Failed to select nodes with XPath expression >'/xsl:transform/*/*/*/xsl:for-each/[EMAIL PROTECTED]'Gac']/@refto'. > > Namespace Manager or XsltContext needed. This query has a prefix, >variable, or user-defined function. > > > >Total time: 0.1 seconds. > > > > > >This is the target I'm trying to match: > > > > ... > > <xsl:for-each select="References/Reference[contains(@refto, >'dbcore')]"> > > <Reference type = "Gac" refto = "dbcore, Version=1.1.0.0, >Culture=neutral, PublicKeyToken=1403d50a7683ade0"/> > > </xsl:for-each> > > ... > > > > > >-----Original Message----- >From: Martin Gainty [mailto:[EMAIL PROTECTED] >Sent: Tuesday, May 18, 2004 7:56 PM >To: James Hafer; [EMAIL PROTECTED] >Subject: Re: [Nant-users] Help with xmlpoke > > > >James > >The trick is to follow the rules of XPath when evaluating the expression >within xmlpoke > >----- Original Message ----- > >From: James <mailto:[EMAIL PROTECTED]> Hafer > >To: [EMAIL PROTECTED] > >Sent: Tuesday, May 18, 2004 9:14 PM > >Subject: [Nant-users] Help with xmlpoke > > > > > >Hello, > > > >I need to change version numbers for particular assemblies referenced >within an XML formatted application.config file. > > > >For example, given this XML: > > > ><References> > ><xsl:for-each select="References/Reference[contains(@refto, 'dbcore')]"> > > <Reference type = "Gac" refto = "dbcore, >Version=1.1.0.0, Culture=neutral, PublicKeyToken=1403d50a7683ade0"/> > ></xsl:for-each> > > <xsl:for-each select="References/Reference[contains(@refto, >'nxunit.framework')]"> > > <Reference type = "Gac" refto= "nxunit.framework, >Version=1.1.0.0, Culture=neutral, PublicKeyToken=1403d50a7683ade0" /> > ></xsl:for-each> > ><xsl:for-each select="References/Reference[contains(@refto, 'nxcore')]" > > > > <Reference type = "Gac" refto = "nxcore, >Version=1.1.0.0, Culture=neutral, PublicKeyToken=1403d50a7683ade0" /> > ></xsl:for-each> > > > >How would xmlpoke be used to change the version for nxunit.framework? I >do not completely understand the syntax if it is even possible to >accomplish. This is as far as I've gotten: > > >assuming you will be supplying value correctly try.. > > > > <xmlpoke >file="${is.appsrcdir}\nxstudio\data\ConversionStyleSheets\ConvertPrjx11 t >o11a.xsl" > > value="${configuration.version}" > xpath="[EMAIL PROTECTED] = >'Version']/@value"/> > ><!-- xpath="/**/References/xsl:for-each/" --> > > >You can also be particular about what you are selecting with this >statement ><xsl:for-each >select="selectNameBetweenQuotesGoesHere[Version='1.1.0.0']"> > >HTH, > >Martin > >(e) <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] >(v)617-852-7822 > > > > > > > > > > _________________________________________________________________ Express yourself with the new version of MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id%62&alloc_ida84&op=ick _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=ick _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users
