[xsl] one more issue on removing dup records

Subject: [xsl] one more issue on removing dup records
From: "Wei Chin" <wei_chin@xxxxxxxxxxx>
Date: Sat, 03 Mar 2007 10:26:53 -0500
Hi Mukul,

i just spot one thing that was due to a missing point in my business rule description, regarding the concatenation of ";headlines;" for the "display_on" attribute.

some releases do not need to have ";headlines;" to be added in the "display_on" attribute.

i tried to make changes on the solution you gave me below but i was not successful. here is what i have revised on your solution:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="release[@display_on = 'headlines;'][fcc_doc_number = ../release[not(@display_on = 'headlines;')]/fcc_doc_number]">
<xsl:attribute name="display_on"><xsl:value-of select="concat(., ';headlines')"/></xsl:attribute>
</xsl:template>


<xsl:template match="release[@display_on = 'headlines;'][normalize-space(fcc_doc_number) = '']">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>


it simply did not append ";headlines:" to all "display_on" attributes.
here is the sample file i am trying to work on, notice release id 19:

<?xml version="1.0" encoding="UTF-8"?>
<releases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<!-- Data group A -->
<release id="2" name="Chairman Bureau" display_on="headlines;" type="NEWS RELEASE">
<fcc_doc_number>6</fcc_doc_number>
</release>
<release id="4" name="Wireless Telecommunications Bureau" display_on="headlines;" type="PUBLIC NOTICE">
<fcc_doc_number>5</fcc_doc_number>
</release>
<release id="6" name="Georgia Pacific Corporation" display_on="headlines;" type="ORDER">
<fcc_doc_number>4</fcc_doc_number>
</release>
<release id="8" name="Garmin International" display_on="headlines;" type="ORDER">
<fcc_doc_number>3</fcc_doc_number>
</release>
<release id="10" name="Wireless Telecommunications Bureau" display_on="headlines;" type="PUBLIC NOTICE">
<fcc_doc_number>2</fcc_doc_number>
</release>
<release id="12" name=" Wireless " display_on="headlines;" type="PUBLIC NOTICE">
<fcc_doc_number />
</release>
<!-- Data group B -->
<release id="14" name="In the Matter of Applications" display_on="uls" type="MEMORANDUM OPINION AND ORDER">
<fcc_doc_number>5</fcc_doc_number>
</release>
<release id="16" name="Auction of FM" display_on="asas" type="PUBLIC NOTICE">
<fcc_doc_number>4</fcc_doc_number>
</release>
<release id="18" name="Modification of Ex Parte Status" display_on="asr" type="PUBLIC NOTICE">
<fcc_doc_number>3</fcc_doc_number>
</release>
<release id="19" name="Modification of Ex Parte Status" display_on="poc" type="ORDER">
<fcc_doc_number>13</fcc_doc_number>
</release>
</releases>


and here is the desried resulting file, noltice release id 19:
<releases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<!-- Data group A -->
<release id="2" name="Chairman Bureau" display_on="headlines;" type="NEWS RELEASE">
<fcc_doc_number>6</fcc_doc_number>
</release>
<release id="10" name="Wireless Telecommunications Bureau" display_on="headlines;" type="PUBLIC NOTICE">
<fcc_doc_number>2</fcc_doc_number>
</release>
<release id="12" name=" Wireless " display_on="headlines;" type="PUBLIC NOTICE">
<fcc_doc_number/>
</release>
<!-- Data group B -->
<release id="14" name="In the Matter of Applications" display_on="uls;headlines;" type="MEMORANDUM OPINION AND ORDER">
<fcc_doc_number>5</fcc_doc_number>
</release>
<release id="16" name="Auction of FM" display_on="asas;headlines;" type="PUBLIC NOTICE">
<fcc_doc_number>4</fcc_doc_number>
</release>
<release id="18" name="Modification of Ex Parte Status" display_on="asr;headlines;" type="PUBLIC NOTICE">
<fcc_doc_number>3</fcc_doc_number>
</release>
<release id="19" name="Modification of Ex Parte Status" display_on="poc" type="ORDER">
<fcc_doc_number>13</fcc_doc_number>
</release>
</releases>



Thank you and have a nice day!


Best Regards,

Wei Chin

_________________________________________________________________
The average US Credit Score is 675. The cost to see yours: $0 by Experian. http://www.freecreditreport.com/pm/default.aspx?sc=660600&bcd=EMAILFOOTERAVERAGE


Current Thread