Jump to content

Help with multiple transform/choose/replace


Recommended Posts

Hi folks, 

Would love to get some assistance with some basic XSLT coding for a template/choose or transform. 

I have the following XSLT coding which is used to essentially transform (replace) the subject line of an email which is generated by the system. This small section of text allows me to put in the company name to be used in the "Value of select" and this I can kind of follow. 

XSLT Template/Code

 <xsl:template match="@* | node()">
         <xsl:apply-templates select="@* | node()"/>

   <xsl:template match="//*[local-name() = 'ReportHeader']/*[local-name() = 'Note']">
                        <xsl:attribute name="author">email</xsl:attribute>
               <xsl:attribute name="entryDateTime"><xsl:value-of select="./@entryDateTime"/></xsl:attribute>
               <xsl:attribute name="languageID">en-US</xsl:attribute>
               <xsl:attribute name="status">Open</xsl:attribute>
               <xsl:attribute name="type">SubjectLine</xsl:attribute>
               <xsl:attribute name="use">External</xsl:attribute>
               <xsl:value-of select="concat('Company 1000 - ',.)"/>


This is the section of the XML that the above template is modifying

<Note author="user id" entryDateTime="2018-02-15T22:46:13Z" languageID="en-US" status="Open" type="SubjectLine" use="External">Acknowledgement for 219-00</Note>

When testing the output it successfully changes the above to the following 

<Note author="email" entryDateTime="2018-02-15T22:46:13Z" languageID="en-US" status="Open" type="SubjectLine" use="External">Company 1000 - Acknowledgement for 219-00</Note>

 (This is the section of the XML code that refers to the "Report Header" and has the accounting entity in the document ID) 

            <ID accountingEntity="1000" variationID="1012">Acknowledgement_219-00</ID>

In some instances we have multiple accounting entities and what I would love to be able to do is have some XSLT code to "choose" between the various Accounting Entities and apply the above template (with different names for each accounting entities).Or at the min is there a way of saying when accounting entity = value choose "template a" which for example would be Company 1000 or choose "template b" and the value would be Company 2000 (for example) 

What would be the best way to edit/write this to be able to have, essentially, a different Company name in the subject line that corresponds to the relative Accounting Entity ID? 

Thanks in advance, 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...