xsl-list
[Top] [All Lists]

Re: [SOLVED] RE: [xsl] grouping - XSLT 1.0

2005-04-14 01:59:56

<xsl:template match="Help"

so here your current node is Help

<xsl:for-each select="./Help[(_at_)Category

and here you are selecting all the Help children of the current node,
which is the empty set as your Help elements are emoty.

This blows up.
"blows up" isn't a very helpful description, gies an error? does the
wrong thing? runs out of memory? I'd expect it to work but just produce
nothing from the for-each loop.



tried this but didn't yield the result I wanted

                <xsl:if test="./Help[(_at_)Category='Clerical:']">
                        <xsl:call-template name="clerical"/>
                </xsl:if>
                <xsl:if test="./Help[(_at_)Category='Technical:']">
                        <xsl:call-template name="technical"/>
                </xsl:if>
                <xsl:if test="./Help[(_at_)Category='Professional:']">
                        <xsl:call-template name="professional"/>
                </xsl:if>
                <xsl:if test="./Help[(_at_)Category='Supervisor:']">
                        <xsl:call-template name="supervisor"/>
                </xsl:if>
                <xsl:if test="./Help[(_at_)Category='Leader:']">
                        <xsl:call-template name="leader"/>
                </xsl:if>



If you wanted a list of if's it would be better to use an xsl:choose
as then the testing can stop as soon as a match is found, but this block
of code just looks like it is implementing a slow version of
apply-templates.

Just replace it all by
<xsl:apply-templates select="@Category"/>

and replace

xsl:template name="supervisor"

by

xsl:template match="@Category[.='Supervisor:']"

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>