Remove repeating mnemonic in XSLT

60 views Asked by At

Below is my XML:

<?xml version="1.0" encoding="utf-8" ?>
<printArtifactGroup>
 
    <grade.content ID="I62A48BC0BA4A11DDB4B4B6752E1F6B33" legacy.identifier="008937755">
        <head.block ID="I70A39401BA6311DD89A8F4F9961D7639">
            <codes.head ID="I70A39402BA6311DD89A8F4F9961D7639" md.mnem="hg5">
                <head.info>
                    <label.name>ARTICLE</label.name>
                    <label.designator>1</label.designator><headtext>GENERAL</headtext>
                </head.info>
            </codes.head>
        </head.block>
    </grade.content>
        <grade.content ID="I62A48BC0BA4A11DDB4B4B6752E1F6B33" legacy.identifier="008937755">
        <head.block ID="I70A39401BA6311DD89A8F4F9961D7639">
            <codes.head ID="I70A39402BA6311DD89A8F4F9961D7639" md.mnem="hg5">
                <head.info>
                    <label.name>ARTICLE</label.name>
                    <label.designator>1</label.designator><headtext>GENERAL</headtext>
                </head.info>
            </codes.head>
        </head.block>
    </grade.content>
    <grade.content ID="I1A9FCF10BA4A11D" legacy.identifier="009063316">
        <head.block ID="I646E0120BA4A11DD812BA1B579905706">
            <codes.head ID="I646E0121BA4A11DD812BA1B579905706" md.mnem="hg5">
                <head.info>
                    <label.name>ARTICLE</label.name>
                    <label.designator>1</label.designator>
                </head.info>
            </codes.head>
            <codes.head ID="I646E2830BA4A11DD812BA1B579905706" md.mnem="hg5c">
                <head.info>
                    <headtext>GENERAL</headtext>
                </head.info>
            </codes.head>
        </head.block>
    </grade.content>
</printArtifactGroup>

Output XML:

<?xml version="1.0" encoding="utf-8" ?>
<printArtifactGroup>
 
    <grade.content ID="I62A48BC0BA4A11DDB4B4B6752E1F6B33" legacy.identifier="008937755">
        <head.block ID="I70A39401BA6311DD89A8F4F9961D7639">
            <codes.head ID="I70A39402BA6311DD89A8F4F9961D7639" md.mnem="hg5">
                <head.info>
                    <label.name>ARTICLE</label.name>
                    <label.designator>1</label.designator><headtext>GENERAL</headtext>
                </head.info>
            </codes.head>
        </head.block>
    </grade.content>
</printArtifactGroup>

I want the repeating mnemonic to be removed having the same content. What will be the XSLT given template is <xsl:template match="head.block/codes.head">?

I tried something but that didn't change anything.

0

There are 0 answers