Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 4th, 2014, 02:10 PM
Authorized User
 
Join Date: Mar 2014
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default attribute set having no effect

Hello,

I have the following attribute set:

<xsl:attribute-set name="table_header_font">
<xsl:attribute name="fname">verdana</xsl:attribute>
<xsl:attribute name="size">8pt</xsl:attribute>
<xsl:attribute name="font-weight">bold</xs;:attribute>
</xsl:attribute-set>

This is stored in Commonfunctions.xsl.

I have another xsl file: PersonalTitle2.xsl in which I have this:

<Table border="1" cellspacing="0" cellpadding="0" width="100%" xsl:use-attribute-sets="table_light_border" style="font-size: 8pt; font-

family: verdana;">
<THEAD> <!-- style="font-size: 8pt; font-family: verdana; font-weight: bold;">-->
<font xsl:use-attribute-sets="table_header_font">
PATIENT IDENTIFICATION
</font>
</THEAD>

But this is what shows up:

http://www.shahspace.com/incorrect_look.jpg

This is completely the wrong look. It's defaulting to Times New Roman and the size is obviously WAY off.

If I remove the reference to table_header_font in my THEAD and use the CSS commented out above instead, I get this:

http://www.shahspace.com/correct_look.jpg

This is the correct look.

Why does my attribute set not work? I know that the attribute set for the table overall (table_light_border), which also comes from Commonfunctions.xsl, works as I can manipulate the values therein and get the expected effect. But my attribute set for my table header seems to have no effect.

Could it be that my table header attribute set cannot override the table attribute set? But my table attribute set only touches border settings, not font.

Your help is much appreciated.
 
Old June 4th, 2014, 02:51 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

What is the output of your transformation? You need to find out whether the transformation is generating the HTML you expect. If it is, then you have an HTML problem, not an XSLT problem. If it is not generating the HTML you expect, then show us the actual and the expected output, in the form of HTML markup.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old June 5th, 2014, 02:41 PM
Authorized User
 
Join Date: Mar 2014
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mhkay View Post
What is the output of your transformation? You need to find out whether the transformation is generating the HTML you expect. If it is, then you have an HTML problem, not an XSLT problem. If it is not generating the HTML you expect, then show us the actual and the expected output, in the form of HTML markup.
Thanks mhkay,

You hinted at the source of the problem and I was able to solve it. The problem was I was expecting the attribute set to substitute for CSS. I guess it doesn't. It substitutes for basic HTML attributes.

Next, I went to the w3schools to look up the font attributes, and it turns out there's only 3: face, size, and color.

So I replaced my fname attribute with face, took out the "pt" from size and reduced it to 1, and simply commented out the font-weight attribute (for font weight, I just put <b> tags around my table header). That worked. So it was an HTML problem.

Thanks for pointing me in the right direction.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamically determining the name of an attribute-set Shadowgopher XSLT 1 July 17th, 2009 04:23 PM
set image size from attribute bonekrusher XSLT 12 August 10th, 2006 05:49 AM
Error - Attribute cannot be set now ajish_jose Access 6 February 1st, 2005 04:38 AM
Dynamically set selected attribute fs22 Javascript How-To 5 December 24th, 2004 04:10 PM
Effect of set nocount on return status puneetmittal1974 SQL Server 2000 5 May 24th, 2004 04:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.