Connecting Tech Pros Worldwide Forums | Help | Site Map

Cascading styles through XSLT

Newbie
 
Join Date: Dec 2007
Posts: 2
#1: Dec 4 '07
Hi.

I have the following XML ..

Expand|Select|Wrap|Line Numbers
  1. <?xml-stylesheet type="text/xsl" href="try.xslt"?>
  2. <head>
  3.     <title>Title</title>
  4.     <desc> <p>Description<ul><li>item 1</li><li>item 2</li></ul></p>
  5.     </desc>
  6. </head>
I am trying to transform it into the following HTML using XSLT.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <p style="font-size: 11px; line-height: 15px;">
  4.    <!-- content of the <desc> tag in the XML should appear here.
  5. </p>
  6. </body>
  7. </html>
The problem is that I have some styles defined for the para tag above in the HTML. This doesn't cascade down into the para tags present in the content of the <desc> tag in the XML.

What I get is this...

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. <p style="font-size: 11px; line-height: 15px;">
  4.    <p>Description<ul><li>item 1</li><li>item 2</li></ul></p></p>
  5. </body>
  6. </html>
I have been asked not to use CSS due to earlier problems in getting it to display correctly in certain email clients and instead use only inline styles. I also don't have control over the XML and I have been informed that the content of the <desc> tag will contain rich text (with HTML formatting tags).

So, is there anyway I can cascade the styles defined above to the para tags within the content of the <desc> tag?

Any help/pointers is appreciated. Thanks.
Moderator
 
Join Date: Mar 2006
Posts: 1,103
#2: Dec 4 '07

re: Cascading styles through XSLT


The problem might be related to the use of paragraph <p> tags instead of using <div>s Can you use <div> instead?
Newbie
 
Join Date: Dec 2007
Posts: 2
#3: Dec 5 '07

re: Cascading styles through XSLT


Thanks a lot! It did the trick. :)
Reply