RE: Applying template to Attributes

Subject: RE: Applying template to Attributes
From: Guy Pirostsky <Guy@xxxxxxxx>
Date: Fri, 26 Nov 1999 15:12:06 +0200
I am using
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>

My file is 

<?xml version="1.0"?>
<?xml-stylesheet href="test.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<page>
  <TEST>
 
      <COMPONENT NAME="name1" VIEW="view1">
	|name1 view1|
      </COMPONENT>
      <COMPONENT NAME="name1" VIEW="view2">
        |name1 view2|
      </COMPONENT>
      <COMPONENT NAME="name2">
       |name2|
        <TAG1>|tag1|</TAG1>
        <TAG2>|tag2|</TAG2>
      </COMPONENT>

     <COMPONENT NAME="name3" VIEW="view1">
       name3 view1
      </COMPONENT>

 </TEST>
</page>

stylesheet:

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0";>
 

  <xsl:template match="page">
    <HTML>
    <HEAD>
    </HEAD>
    <BODY BGCOLOR="white">
<xsl:apply-templates/>
    </BODY>
    </HTML>
  </xsl:template>

  <xsl:template match="COMPONENT[@NAME='name1']" >
  transformed name1
  </xsl:template>


</xsl:stylesheet>


provides result 

<HTML><HEAD></HEAD><BODY BGCOLOR="white">transformed name1transformed name1
       |name2|
        |tag1||tag2|
       name3 view1
      </BODY></HTML>

Haw can I write different templates for each name and for each view?


-----Original Message-----
From: Steve Dahl [mailto:sdahl@xxxxxxxxxxx]
Sent: Wednesday, November 24, 1999 4:53 PM
To: Guy Pirostsky
Subject: Re: Applying template to Attributes


Which XSL processor are you using? What other templates are there that
might match a COMPONENT? What is the order of the templates that match
COMPONENT?


Guy Pirostsky wrote:

> Hello,
> I'd like to apply template to the following element
>
>  <COMPONENT NAME="name1" VIEW="view1">
>
> This Template doesn't works:
>
> <xsl:template match="COMPONENT[@NAME='name1' and @VIEW='view1']" >
>
> What syntax is valid to apply the Template?

--
- Steve Dahl
sdahl@xxxxxxxxxxx


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


Current Thread