This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

attribute value replaced with <xsl:attribute/>?


hello list,

<xsl:attribute name="smth"/>
replaces the hardcoded original "@smth" attribute in an element like
<el smth="*">
is it ok? am i safe putting default values into
<el>
and when needed replace the value with
    <xsl:if test="">
        <xsl:attribute/>
    </xsl:if>
or should i put default stuff into
<xsl:otherwise/>?
i use xalan and i wonder if this behaviour common to all processors?

for example i have:

<?xml version='1.0' encoding='UTF-8' ?>
<xsl:stylesheet version='1.0' xmlns:xalan='http://xml.apache.org/xalan'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >
<xsl:output method="html" indent="yes" />

 <xsl:template match="/">
  <html>
   <body>
    <table border="1">
     <tr>
     <td class="jian">
      <xsl:attribute name="class">
       <xsl:text>sizaki</xsl:text>
      </xsl:attribute>
      <xsl:text>does it change?</xsl:text>
     </td>
     </tr>
    </table>
   </body>
  </html>
 </xsl:template>
</xsl:stylesheet>

and i get:

<html xmlns:xalan="http://xml.apache.org/xalan">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table border="1">
<tr>
<td class="sizaki">does it change?</td>
</tr>
</table>
</body>
</html>

note that instead of
    <td class="jian" class="sizaki">does it change?</td>
i get:
    <td class="sizaki">does it change?</td>

thank you.

jian



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]