RE: [xsl] The use of a variable in use-attribute-sets attribute

Subject: RE: [xsl] The use of a variable in use-attribute-sets attribute
From: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx
Date: Tue, 15 May 2001 12:25:45 +1000
Dan wrote:
> I made an attempt at your problem. Someone else can clarify how
> to get the namespace "fo" on the output elements. There is discussion
> in MK's book concerning what happens when the name attribute of
> an xsl:element has a prefix - something to the effect that the
> namespace must be 'in-scope'. I need clarification what this means
> myself.
> 

Thanks a lot Dan,
Your 'attempt' worked perfectly, I'll call it a solution. I wasn't aware you can do a template match on an attribute, I assumed it only worked for node type element.

Regarding the name attribute having a prefix, I had no problems with using the namespace-prefix in the value of the attribute once the prefix was defined in the root stylesheet element. Xalan threw an error when the namespace was not declared in the root document but used later on. I also would like to read a more reasoned argument, besides 'this gets around the problem', on the matter.

Thanks again,
Joshua

I modified the XSL you suggested as an example

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
 <xsl:output indent="yes"/>
 <xsl:template match="root">
  <something>
   <xsl:apply-templates select="td"/>
  </something>
 </xsl:template>
 <xsl:template match="td">
  <xsl:element name="fo:table-cell">
   <xsl:apply-templates select="@class"/>
   <xsl:element name="fo:block">
    <xsl:copy-of select="text()"/>
   </xsl:element>
  </xsl:element>
 </xsl:template>
 <xsl:template match="@class">
  <xsl:choose>
   <xsl:when test=".='classname1'">
    <xsl:attribute name="font-size">12pt</xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
   </xsl:when>
   <xsl:when test=".='classname2'">
    <xsl:attribute name="font-size">14pt</xsl:attribute>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
   </xsl:when>
   <xsl:when test=".='classname3'">
    <xsl:attribute name="font-size">16pt</xsl:attribute>
    <xsl:attribute name="font-weight">normal</xsl:attribute>
   </xsl:when>
  </xsl:choose>
 </xsl:template>  
</xsl:stylesheet>

------------------------------------------------------------------------------
This message and any attachment is confidential and may be privileged or otherwise protected from disclosure.  If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.





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


Current Thread