This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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) &lt; '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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]