XSLT to convert a xml document back to xml2
This is an open discussion with 4 replies, filed under XSLT.
Search
Is this a Symphony project? It sounds to me like a .Net project.
@Urvashi - You’ll want to use the Muenchian Method of Grouping. Use Jeni Tennison’s site, http://jenitennison.com/xslt/grouping/ to learn more about it.
@bzerangue - Thanks for the link it is quiet useful. @designermonkey - No it is not a Symphony project.
I tried the following xslt based on the jenitennison link but it doesn’t seem to be working. Can anybody help?
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:key name="rows" match="AddressResults" use="ID" /> <xsl:template match="SearchResultsAddressDataSet"> <xsl:apply-templates select="AddressResults[generate-id(.) = generate-id(key('rows', ID)[1])]" /> </xsl:template> <xsl:template match="AddressResults"> <b><xsl:value-of select="ID" /></b> <AddressResults><ID><xsl:value-of select="ID" /></ID> <Country><xsl:value-of select="Country" /> </Country> <PostalCode><xsl:value-of select="PostalCode" /> </PostalCode><Deleted><xsl:value-of select="Deleted" /> </Deleted><lAddressLines> <xsl:for-each select="key('rows', ID)"> <xsl:value-of select="lAddressLines" />, </xsl:for-each> </lAddressLines> </AddressResults> </xsl:template> </xsl:stylesheet>
Thanks in advance
Create an account or sign in to comment.
I am creating this topic again as I am now unable to open the previous one. What would be the XSLT like to convert the following xml
to the following xml
i.e. address lines have been comma separated and in one record only.
Thanks