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 4550158
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:27:32+00:00 2026-05-21T16:27:32+00:00

I would like subtitute the variables (in brackets) in the AgreementTexts with values of

  • 0

I would like subtitute the variables (in brackets) in the AgreementTexts with values of the same named elements (without brackets of course) in the XML.

Can anybody help me how to do this?
thanks!
Adam

This is my XML:

<MailBody>
  <MSG_BOComment_PDF type="string" /> 
  <HSH_Is_Migrated type="string">NO</HSH_Is_Migrated> 
  <PDFC_X_Cust type="string">7990122189</PDFC_X_Cust> 
  <PDFC_X_FOBO_Id type="string">68281 / 41080</PDFC_X_FOBO_Id> 
  <PDFC_RPDealTradTime type="dateTime">06/04/2010 11:32:00</PDFC_RPDealTradTime> 
  <MSG_ConfTypeDE type="string">DEUTSCH</MSG_ConfTypeDE> 
  <MSG_ConfTypeEN type="string">ENGLISH</MSG_ConfTypeEN> 
  <Msg_SpecAgreeTxt2>
  <LINE_ON>
  <AgreementText type="string">The Buyer agrees that [MSG_ConfTypeDE], for the purpose of paragraph 8(a) of the Agreement, bonds that, in the determination of the Buyer (acting reasonably), meet each of the following criteria, shall be eligible as New Purchased Securities:</AgreementText> 
  </LINE_ON>
  <LINE_ON>
  <AgreementText type="string">(1) EITHER: Test+</AgreementText> 
  </LINE_ON>
  <LINE_ON>
  <AgreementText type="string">(A) The bonds [PDFC_X_FOBO_Id] have the of a grandfathered guarantee (Gew?tr?rhaftung) from, or are issued by, the Federal Re-public of Germany or one of its constituent States (L?er) and are rated by at least two of Fitch Ratings Inc, Moody? Investors Service, Inc</AgreementText> 
  </LINE_ON>
  <LINE_ON>
  <AgreementText type="string">OR+</AgreementText> 
  </LINE_ON>
  <LINE_ON>
  <AgreementText type="string">(B) The bonds are issued by LFAF??rbank Bayern and are guaranteed by the State of Bavaria and are rated at least one Rating Agency and</AgreementText> 
  </LINE_ON>
  <LINE_ON>
  <AgreementText type="string">(2) The bonds are [PDFC_X_FOBO_Id] denominated in Euro.</AgreementText> 
  </LINE_ON>
  </Msg_SpecAgreeTxt2>
  <MSG_EntC_EmailTo type="string">mmfx.backoffice@hsh-nordbank.com</MSG_EntC_EmailTo> 
  <MSG_C_Address1 type="string" /> 
  <MSG_C_Address2 type="string">ML Financial Centre</MSG_C_Address2> 
  <MSG_C_Address3 type="string">2 King Edward Street</MSG_C_Address3> 
  <MSG_C_Address4 type="string">LONDON EC1A 1HQ|GROSSBRITANNIEN</MSG_C_Address4> 
  <MSG_C_ContactName type="string">Merrill Lynch International</MSG_C_ContactName> 
  <MSG_EntC_Address1 type="string">Transaction Services</MSG_EntC_Address1> 
  <MSG_EntC_FaxAddress type="string">+49 431 900 34082</MSG_EntC_FaxAddress> 
  <MSG_EntC_PhoneNumber type="string">+49 431 900 11428</MSG_EntC_PhoneNumber> 
  <MSG_EntC_Address2 type="string">OE 3651 Geld- und Devisenabwicklung</MSG_EntC_Address2> 
  <MSG_EntC_Address3 type="string">Martensdamm 6</MSG_EntC_Address3> 
  <MSG_EntC_Address4 type="string">24103 Kiel</MSG_EntC_Address4> 
  <MSG_EntC_ContactName type="string">HSH Nordbank AG</MSG_EntC_ContactName> 
  <EVT_EventDate type="date">06/04/2010</EVT_EventDate> 
  <MSG_ConfTypeEN type="string" /> 
  <MUR type="string">KTPP86425</MUR> 
  <MailHeader_Id type="int">86425</MailHeader_Id> 
</MailBody>

After implementing Flynn’S solution I got this output. But this not exactly what I want.
I get before and after AgreementText values of elements in the same order from XML…

NO 7990122189 68281 / 41080 06/04/2010
11:32:00 DEUTSCH ENGLISH The Buyer
agrees that DEUTSCH, for the purpose
of paragraph 8(a) of the Agreement,
bonds that, in the determination of
the Buyer (acting reasonably), meet
each of the following criteria, shall
be eligible as New Purchased
Securities:

(1) EITHER: Test+

(A) The bonds 68281 / 41080 have the
of a grandfathered guarantee
(Gew?tr?rhaftung) from, or are issued
by, the Federal Re-public of Germany
or one of its constituent States
(L?er) and are rated by at least two
of Fitch Ratings Inc, Moody? Investors
Service, Inc

OR+

(B) The bonds are issued by
LFAF??rbank Bayern and are guaranteed
by the State of Bavaria and are rated
at least one Rating Agency and

(2) The bonds are 68281 / 41080
denominated in Euro.

mmfx.backoffice@hsh-nordbank.com ML
Financial Centre 2 King Edward Street
LONDON EC1A 1HQ| GROSSBRITANNIEN
Merrill Lynch International
Transaction Services +49 431 900 34082
+49 431 900 11428 OE 3651 Geld- und Devisenabwicklung Martensdamm 6 24103
Kiel HSH Nordbank AG 06/04/2010
KTPP86425 86425

This is my expected output: Only the [Variables.in.brackets] in the AgreementText’s should be substituted with values of same name elements in XML.

The Buyer agrees that DEUTSCH, for the
purpose of paragraph 8(a) of the
Agreement, bonds that, in the
determination of the Buyer (acting
reasonably), meet each of the
following criteria, shall be eligible
as New Purchased Securities:

(1) EITHER: Test+

(A) The bonds 68281 / 41080 have the
of a grandfathered guarantee
(Gew?tr?rhaftung) from, or are issued
by, the Federal Re-public of Germany
or one of its constituent States
(L?er) and are rated by at least two
of Fitch Ratings Inc, Moody? Investors
Service, Inc

OR+

(B) The bonds are issued by
LFAF??rbank Bayern and are guaranteed
by the State of Bavaria and are rated
at least one Rating Agency and

(2) The bonds are 68281 / 41080
denominated in Euro.

This is my xsl file:

  <?xml version="1.0" encoding="ISO-8859-1" ?> 
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java" xmlns:date="http://exslt.org/dates-and-times">
  <xsl:key name="vars" match="*" use="name()" /> 
  <xsl:template match="/">
  <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
  <fo:simple-page-master master-name="single_page" page-height="297mm" page-width="210mm" margin-left="25mm" margin-bottom="10mm" margin-right="13mm" margin-top="7mm">
  <fo:region-body region-name="xsl-region-body" /> 
  <fo:region-after region-name="page-numbering" extent="15mm" /> 
  </fo:simple-page-master>
  <fo:page-sequence-master master-name="repeatable_master">
  <fo:repeatable-page-master-reference master-reference="single_page" maximum-repeats="10" /> 
  </fo:page-sequence-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="repeatable_master">
  <fo:flow flow-name="xsl-region-body">
  <xsl:call-template name="MailBody" /> 
  </fo:flow>
  </fo:page-sequence>
  </fo:root>
  </xsl:template>
  <xsl:template name="MailBody">
  <fo:table font-size="10.00pt" width="170.00mm">
  <fo:table-column column-width="170mm" /> 
  <fo:table-body>
  <fo:table-row height="1mm">
  <fo:table-cell>
  <fo:block>
  <xsl:apply-templates select="@* | node()" /> 
  </fo:block>
  </fo:table-cell>
  </fo:table-row>
  </fo:table-body>
  </fo:table>
  </xsl:template>
  <xsl:template match="Msg_SpecAgreeTxt2/LINE_ON/AgreementText/text()" name="replace">
  <xsl:param name="text" select="." /> 
  <xsl:choose>
  <xsl:when test="contains($text,'[')">
  <xsl:variable name="varname" select="substring-before(substring-after($text,'['),']')" /> 
  <xsl:value-of select="substring-before($text,'[')" /> 
  <xsl:value-of select="key('vars',$varname)" /> 
  <xsl:call-template name="replace">
  <xsl:with-param name="text" select="substring-after($text,']')" /> 
  </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
  <xsl:value-of select="$text" /> 
  <fo:block space-after="10px" /> 
  </xsl:otherwise>
  </xsl:choose>
  </xsl:template>
  </xsl:stylesheet>

Sorry for multiple editing, wrong usage as I’m totally newbie here ;))

  • 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-21T16:27:33+00:00Added an answer on May 21, 2026 at 4:27 pm

    Try this template:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:key name="vars" match="*" use="name()" />
    
      <xsl:template match="Msg_SpecAgreeTxt2/LINE_ON/AgreementText/text()" name="replace">
        <xsl:param name="text" select="." />
        <xsl:choose>
          <xsl:when test="contains($text,'[')">
            <xsl:variable name="varname" select="substring-before(substring-after($text,'['),']')" />
            <xsl:value-of select="substring-before($text,'[')" />
            <xsl:value-of select="key('vars',$varname)" />
            <xsl:call-template name="replace">
              <xsl:with-param name="text" select="substring-after($text,']')" />
            </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$text" />
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>
    </xsl:stylesheet>
    

    The key at the top isn’t very efficient though, but without knowing their ancestry, there’s no good way of deriving an efficient way of matching the nodes containing the values to replace.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file containing substituted variables ( #{...} ) and I would like
Would like to get a list of advantages and disadvantages of using Stored Procedures.
Would like to create a strong password in C++. Any suggestions? I assume it
Would like to be able to set colors of headings and such, different font
Would like to know what a programmer should know to become a good at
Would like to make anapplication in Java that will not automatically parse parameters used
Would like to know the c# code to actually retrieve the IP type: Static
Would like to know how to integarate cruise control with maven? Cruise Control comes
Would like to know how to hide an div after a set of css3
I would like to test a string containing a path to a file for

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.