[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Detecting a break in data
Thanks Tom, and all others that chipped in to help me out with this. After a little fiddling with the key to use a substring of a substring-after, and figuring out how to use this on the match, and then nest a second key within that, I have finally got the display I needed. Unfortunately, it proved that my data is unreliable in its content and needs a little more analysis and perhaps pre-processing - but it was a valuable learning experience. I feel a little more confident that I understand the relationship between XML and XSL now. Regards, Graham. PS - here is my (perhaps) final code in case the use of the substring keys is of any use to anyone <xsl:key name="byRecType" match="MapRule" use="substring(substring-after(objectset,':'),1,7)"/> <xsl:key name="byFldType" match="MapRule" use="substring-before(substring-after(objectset,' '),' ')"/> <xsl:template match="/"> <html> <body> <h2>Mercator Map Rules</h2> <xsl:for-each select="MMS"> <h3><xsl:value-of select="@path"/></h3> <xsl:for-each select="Map"> <xsl:variable name="MapID" select="@name"/> <h4>Mappings for: <xsl:value-of select="$MapID"/></h4> <xsl:for-each select=".//MapRule[generate-id() = generate-id(key('byRecType',substring(substring-after(objectset,':'),1,7)) [1])]"> <xsl:for-each select="key('byRecType',substring(substring-after(objectset,':'),1,7))"> <xsl:variable name="fldnm" select="substring-before(objectset,' ')"/> <xsl:variable name="rest1" select="substring-after(objectset,' ')"/> <xsl:variable name="fldtyp" select="substring-before($rest1,' ')"/> <xsl:variable name="rest2" select="substring-after($rest1,':')"/> <xsl:variable name="rectyp" select="substring-before($rest2,' ')"/> Rule <xsl:value-of select="@rulenumber"/>: <font size="-1" color="blue"><strong> <xsl:choose> <xsl:when test="string-length($fldnm) < '1'"> <xsl:value-of select="objectset"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$fldnm"/> ( <xsl:value-of select="$fldtyp"/> in <xsl:value-of select="$rectyp"/>) </xsl:otherwise> </xsl:choose> <xsl:value-of select="' = '"/> <xsl:value-of select="substring-after(objectrule,'=')"/><BR/> </strong></font> </xsl:for-each> <p/> </xsl:for-each> </xsl:for-each> <p/> </xsl:for-each> </body> </html> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|