|
next
|
Subject: Same name and different property in xml Author: Minollo I. Date: 07 Jun 2006 01:41 PM
|
Something like this? You may have to change the "concat" function to get the proper grouping logic.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="records" match="records/record" use="concat(SRC_URL, DATES, PHONE_NAME, MODELS)"/>
<xsl:template match="/">
<device-list>
<xsl:for-each select="/records/record[generate-id() = generate-id(key('records', concat(SRC_URL, DATES, PHONE_NAME, MODELS))[1])]">
<device manufacturer="{PHONE_NAME}" name="{MODELS}" src-url="{SRC_URL}" retrieval-time="{DATES}">
<xsl:variable name="keyVal" select="concat(SRC_URL, DATES, PHONE_NAME, MODELS)"/>
<xsl:for-each select="/records/record[concat(SRC_URL, DATES, PHONE_NAME, MODELS) = $keyVal]">
<property name="{PROPERTY}" value="{VALUE1}"/>
</xsl:for-each>
</device>
</xsl:for-each>
</device-list>
</xsl:template>
</xsl:stylesheet>
|
|
|