Subject: [xsl] Trouble removing dup elements based on attributes From: "Al Bean" <albean88@xxxxxxxxxxx> Date: Fri, 24 Jun 2005 23:14:04 +0000 |
---------------------- My XSL ----------------------
<xsl:template mode="XXX" match="attrib[@name='Names']/rs/row"> <xsl:element name="ns:name"> <xsl:value-of select="@firstname"/> </xsl:element> </xsl:template> </xsl:transform>
---------------------------------------------------- Input XML : ----------------------------------------------------
<prods> <product> <attrib name="P">product 1</attrib> <attrib name="Names"> <rs> <row firstname="Bill"/> <row firstname="Bill"/> </rs> </attrib> </product> <product> <attrib name="P">product 2</attrib> <attrib name="Names"> <rs> <row firstname="Sam"/> <row firstname="Ron"/> <row firstname="Sam"/> <row firstname="Ron"/> </rs> </attrib> </product> <product> <attrib name="P">product 3</attrib> <attrib name="Names"> <rs> <row firstname="Ron"/> <row firstname="Sam"/> <row firstname="Joe"/> <row firstname="Sam"/>
</rs> </attrib> </product> </prods>
---------------------------------------------------- This is the OUTPUT that I want (note no name dups): ----------------------------------------------------
<ns:Products xmlns:ns="http://w.ns.c/ns/prod/"> <ns:Product> <ns:Names> <ns:name>Bill</ns:name> </ns:Names> </ns:Product> <ns:Product> <ns:Names> <ns:name>Sam</ns:name> <ns:name>Ron</ns:name> </ns:Names> </ns:Product> <ns:Product> <ns:Names> <ns:name>Ron</ns:name> <ns:name>Joe</ns:name> <ns:name>Sam</ns:name> </ns:Names> </ns:Product> </ns:Products>
---------------------------------------------------- But this is the OUTPUT that I get (note the name dupes): ---------------------------------------------------- <ns:Products xmlns:ns="http://w.ns.c/ns/prod/"> <ns:Product> <ns:Names> <ns:name>Bill</ns:name> <ns:name>Bill</ns:name> </ns:Names> </ns:Product> <ns:Product> <ns:Names> <ns:name>Sam</ns:name> <ns:name>Ron</ns:name> <ns:name>Sam</ns:name> <ns:name>Ron</ns:name> </ns:Names> </ns:Product> <ns:Product> <ns:Names> <ns:name>Ron</ns:name> <ns:name>Sam</ns:name> <ns:name>Joe</ns:name> <ns:name>Sam</ns:name> </ns:Names> </ns:Product> </ns:Products>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Counting preceding nodes, mike@xxxxxxxxxxxx | Thread | Re: [xsl] Trouble removing dup elem, Sam D. Chuparkoff |
[xsl] Counting preceding nodes, Billie | Date | Re: [xsl] Trouble removing dup elem, Sam D. Chuparkoff |
Month |