RE: XSL : template for attribute

Subject: RE: XSL : template for attribute
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 27 Apr 1999 17:55:43 +0100
You have written a template to process this attribute but you haven't
invoked it. <xsl:apply-templates> processes the child character nodes and
child elements but not the attributes. To process the attributes, write
<xsl:apply-templates select="@*"/>
 
Alternatively write <xsl:if test=".[@crlf]"><br /></xsl:if> in the parent
template (exact syntax depends what product you are using, you should always
say).
Mike Kay

-----Original Message-----
From: Chanukov Orit [mailto:orit@xxxxxxxxxxxxxxx]
Sent: 27 April 1999 15:49
To: XSL-List@xxxxxxxxxxxxxxxx
Subject: XSL : template for attribute 


Hello .
 
How should I write template for attribute ? 
 
In my XML file I have , for example , the following line : 
 
 <Field line="16" offset="1" colr="8" crlf="1" >Selection or command</Field>
 
crlf attribute should insert <&br> to the output .
Different nodes of XML  tree have this attribute ( not only Field ) .
 
in XSL file I wrote the following : 
 
<xsl:template match="text()"><xsl:value-of /></xsl:template>
 
<xsl:template match="Field">
<xsl:apply-templates />
</xsl:template>

<xsl:template match="@crlf">
    <br></br>
 </xsl:template>
 
It doesn't work .
What wrong here ?
See attached XML and XSL files .
 
Thanks in advance ,
Orit .
 


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


Current Thread