|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: problems with xsl
At 99/01/15 11:59 -0500, Feng, Min wrote:
> I used the following rules, but the Koala processor reported an
>error, complaining both rules are
> the same.
>
> <xls:template match='col[last-of-type()]'>
> <xsl:value-of expr="attribute(name)"/>
> <xsl:text>,</xsl:text>
> </xsl:template>
>
> <xsl:template match='col'>
> <xsl:value-of expr="attribute(name)"/>
> </xsl:template>
>
> What I did wrong here? If so, how do you generate the list?
Koala is quite correct to complain, because the last element in your group
does, indeed, match more than one pattern.
The solution is to add priority on the more specific pattern (specificity
is no longer part of the standard).
I have an example below that I hope helps ... I'm running XT.
> The second problem I have is:
I don't understand what you are asking here (but I've run out of time this
week to help with answers ... next week is a client week, so I won't get
much time (if any) to contribute) ... perhaps someone else will pick up the
ball on this one.
........ Ken
T:\feng>type test.xml
<?xml version="1.0"?>
<test>
<col name="a1"/>
<col name="a2"/>
<col name="a3"/>
</test>
T:\feng>type test.xsl
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/TR/WD-xsl"
xmlns="http://www.w3.org/TR/REC-html40"
result-ns="">
<xsl:template match='col[last-of-type()]' priority="1">
<xsl:value-of select="@name"/>
</xsl:template>
<xsl:template match='col'>
<xsl:value-of select="@name"/>
<xsl:text>,</xsl:text>
</xsl:template>
</xsl:stylesheet>
T:\feng>call xsl test.xml test.xsl test.htm
T:\feng>type test.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
a1,
a2,
a3
T:\feng>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0 F: +1(613)489-0995
Training: http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training (see training link): WWW8 - 1999-05-11
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
|

Cart








