0

I have an XML file that can have multiple tags with the same name but different attribute values. When I extract the tag in XSLT, it gives me all the values separated by spaces. However, I want the values separated by any other delimiter, like a comma or pipe. Can this be achieved? The XML is as below -

<?xml version='1.0' encoding='UTF-8'?>
<wd:Report_Data xmlns:wd="urn:com.workday.report/CR_INT_Persona_Request">
    <wd:Report_Entry>
        <wd:Request_For_Worker wd:Descriptor="Jennifer Sauvigne">
            <wd:ID wd:type="WID">455b87a53cbe01005867fa601a4b0000</wd:ID>
            <wd:ID wd:type="Employee_ID">10001557</wd:ID>
        </wd:Request_For_Worker>
        <wd:Persona_Request_Reason wd:Descriptor="Agency Transfer">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0001</wd:ID>
        </wd:Persona_Request_Reason>
        <wd:Request_Persona_Type wd:Descriptor="FINS">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0002</wd:ID>
        </wd:Request_Persona_Type>
        <wd:FINS_or_PSA_Persona_Requested
            wd:Descriptor="P013 - Accountant (Which FINS Persona is needed?)">
            <wd:ID wd:type="WID">ae11cc7534c0101560351fbf14da0000</wd:ID>
            <wd:ID wd:type="Question_Multiple_Choice_Answer_ID"
                >QUESTION_MULTIPLE_CHOICE_ANSWER-6-ae11cc7534c0101560351fbf14da0000</wd:ID>
        </wd:FINS_or_PSA_Persona_Requested>
        <wd:FINS_Persona_Requested wd:Descriptor="P013 - Accountant (Which FINS Persona is needed?)">
            <wd:ID wd:type="WID">ae11cc7534c0101560351fbf14da0000</wd:ID>
            <wd:ID wd:type="Question_Multiple_Choice_Answer_ID"
                >QUESTION_MULTIPLE_CHOICE_ANSWER-6-ae11cc7534c0101560351fbf14da0000</wd:ID>
        </wd:FINS_Persona_Requested>
        <wd:Request_Persona_Companies
            wd:Descriptor="CO00002 - Wunderman Thompson Data Consulting LLC">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0005</wd:ID>
        </wd:Request_Persona_Companies>
        <wd:Request_Persona_Companies wd:Descriptor="CO00001 - Absolute Color LLC">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0004</wd:ID>
        </wd:Request_Persona_Companies>
        <wd:Request_Persona_BU_Hierarchies wd:Descriptor="Msft Client Coord">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0007</wd:ID>
        </wd:Request_Persona_BU_Hierarchies>
        <wd:Request_Persona_BU_Hierarchies wd:Descriptor="MSC WW HQ">
            <wd:ID wd:type="WID">5f7f70c485129020102b543c324a0006</wd:ID>
        </wd:Request_Persona_BU_Hierarchies>
    </wd:Report_Entry>
</wd:Report_Data>

The resultant XML should look like this

<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns:wd="urn:com.workday.report/CR_INT_Persona_Request">
    <Persona>P013 - Accountant (Which FINS Persona is needed?)</Persona>
    <Persona_Companies>CO00002 - Wunderman Thompson Data Consulting LLC,CO00001 - Absolute Color
        LLC</Persona_Companies>
    <Persona_BU_hierarchies>Msft Client Coord,MSC WW HQ</Persona_BU_hierarchies>
</Request>

Thanks

Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
VJain
  • 19
  • 4
  • 1
    You forgot to add your XSLT to your question. If you’re using `xsl:value-of` you can use the `separator` attribute to specify a separator. – Daniel Haley May 30 '23 at 20:29
  • 1
    Thanks @DanielHaley. This gives me my answer. I never used that attribute before. – VJain May 30 '23 at 20:52
  • Does this answer your question? [xslt concatenate all descendants of a type using a separator](https://stackoverflow.com/questions/34441429/xslt-concatenate-all-descendants-of-a-type-using-a-separator) – Daniel Haley May 30 '23 at 21:15

0 Answers0