I think this is a grouping problem, and we can use Muenchian grouping
to solve it.

Below is the stylesheet to solve this ...

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               version="1.0">

  <xsl:output method="text" />

  <xsl:variable name="caps" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
  <xsl:variable name="small" select="'abcdefghijklmnopqrstuvwxyz'" />

  <xsl:key name="by-name" match="UnderWriterDataInput/*"
use="translate(local-name(), $small, $caps)" />

  <xsl:template match="UnderWriterDataInput">
    <xsl:for-each select="*[generate-id() = generate-id(key('by-name',
translate(local-name(), $small, $caps))[1])]">
      <xsl:value-of select="translate(local-name(), $small, $caps)" />
: <xsl:value-of select="." />
      <xsl:text>&#xa;</xsl:text>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>


On 8/12/08, Alan Andrade <[EMAIL PROTECTED]> wrote:
>
>
>
> Input:
>
> < UnderWriterDataInput ><q20004>NO</q20004>
>
> <Q20006>NO</Q20006>
>
> <Q20006>NO</Q20006>
>
> <Q20004>NO</Q20004>
>
> </ UnderWriterDataInput >
>
>
>
> OutPut:
>
>
>
> Q20006 NO
>
> Q20004 NO
>
>
>
> XSLT:
>
> <xsl:variable name="unique-list"
> select="//UnderWriterDataInput/child::*[not(name()=following::name)]"
> />
>
>     <xsl:for-each select="$unique-list">
>
>         <xsl:value-of select="name()" />
>
>         <xsl:value-of select="." />
>
>       </xsl:for-each>
>
>
>
> His does not work!! Let me know what is needed to be corrected.
>
> Thanks
>
> Alan


-- 
Regards,
Mukul Gandhi

Reply via email to