xsl-list
[Top] [All Lists]

RE: Template matching similiar names

2003-04-07 11:27:13

Use this.

<xsl:apply-templates select="class[(_at_)element='root']" />

If you want seperate apply-templates for class with root and class with
rootname you can use "mode"

    <xsl:apply-templates select="class[(_at_)element='root']" mode="ROOT"/>
    <xsl:apply-templates select="class[(_at_)element='root']" mode="ROOTHOME"/>



<xsl:template match="FIELD" mode="ROOT">
<xsl:template match="FIELD" mode="ROOTHOME">


-----Original Message-----
From: Holbrook, R Cody (Cody) [mailto:rch7(_at_)avaya(_dot_)com]
Sent: Monday, April 07, 2003 10:05 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Template matching similiar names


Hello All,

I'm having difficulty distinguishing between classes with similiar names.

I start with the following XML

<class element="root">
</class>

<class element="roothome">
</class>

The template match I'm using is incorrect as I only want to have the doc
tags added to the class with the element attribute root.


What I get back is this:

<class element="root">
        <doc>Docs for root</doc>
</class>

<class element="roothome">
        <doc>Docs for root</doc>
</class>


No matter what I've done, I get the same thing, in general my tries have
looked like this:

<xsl:template match="xsd:class...">
        <xsl:copy>
                <xsl:copy-of select="@*"/>
                        <doc>Docs for root</doc>
        ....

Is there a way to make a very exact match with an attribute?

Thanks,

Cody Holbrook



(and many variations, including two starts-with template matches that
worked, but not well)

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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