[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Where's a basic "boiler-plate" xslt for <em>, <st

Subject: Re: Where's a basic "boiler-plate" xslt for <em>, <strong>, etc. in XML -> XHTML?
From: Bill Powell <junk@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Sep 2007 17:20:31 -0400
 Re: Where's a basic "boiler-plate" xslt for <em>
Steve - Wonderful! Thanks very much! This is just the sort
of thing that can slip through the cracks; much appreciated.
I went to the #xml channel on irc.freenode.net, and the only
one who answered was having the same problem. I'm going to
post this on my blog with as many searchable terms as I can
think of, as well as a link to the archived thread.

Thanks again!
Bill Powell


+++ Scott Trenda [28/09/07 16:03 -0500]:
> Bill - 
> 
> XSLT handles HTML output beautifully natively. I'm guessing that you'll
> want something like the following: (I'm not sure what all of your
> non-HTML tags are, so just take the pattern from the sect1 template:)
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:output method="html"/>
> 
>   <!-- This will handle any nodes we don't explicitly define templates
> for.
>        It copies the source as-is, and xsl:output handles the HTML
> format.  -->
>   <xsl:template match="@*|node()">
>     <xsl:copy>
>       <xsl:apply-templates select="@*|node()"/>
>     </xsl:copy>
>   </xsl:template>
> 
>   <!-- sect1 means h1 -->
>   <xsl:template match="sect1">
>     <h1>
>       <xsl:apply-templates select="@*|node()"/>
>     </h1>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> And that's it. Basically, the XSLT processor knows how to handle the
> formatting differences between XML and HTML, so we use <xsl:output
> method="html"/> to put it into that mode. The first template is a basic
> "copy everything" template, and after that, just set up a series of
> templates to intercept nodes that need to be renamed or reformatted.
> 
> Simple enough? ~_^
> 
> ~ Scott

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.