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

RE: Writing a stylesheet to create a stylesheet, with

Subject: RE: Writing a stylesheet to create a stylesheet, with XSLT in the XML
From: Scott Moore <Scott.Moore@xxxxxxxxxxxxx>
Date: Mon, 17 Jun 2002 18:34:00 -0400
creating a stylesheet
> Why?
> 
> I'm asking rhetorically; it's generally a bad idea to try to embed
> markup as character data, and then expect it to be markup upon output.

Okay, you asked...

I'm doing it because I need to create a stylesheet from a stylesheet.  That
stylesheet then creates XSL-FO, which is used to create a PDF.  Our
customers need to control the layout of the report, which is handled by the
original XML file, which is transformed into a driver stylesheet, that is
used to create the XSL-FO.

Now, a new requirement comes in where we need to flexibly allow a
combination of static text and dynamic values in the XML creating the report
(not the driver stylesheet) to be in the header and footer of the report.
The content of the header/footer would be controlled thru the original XML
layout file, which creates the report stylesheet.  In order to be flexible,
I wanted to embed XSL markup in the "label" attribute.


> 
> Ah, but it doesn't. It produces in the result *tree* a single 
> text node
> containing the pseudo-markup
>     < x s l : v a l u e - o f
> and so on, with spaces added to emphasize that it's character data.
> 
> If you intend to produce <xsl:value-of...> in the *serialization*
> of the result tree, then you must have not a text node but an 
> element node 
> with this structure:

Yes, I realize that.  The result tree is *serialized* to a file, which is
then used as a stylesheet by the system later on.  Therefore, the text node
becomes markup.

> 
>   element named 'value-of' in namespace 
> 'http://www.w3.org/1999/XSL/Transform'
>        \___attribute 'select' with value '/Doc/FirstName'
> 
> So, why not have
> 
>   <Sections>
>     <label>
>       <xsl:value-of select="/Doc/FirstName"/>
>     </label>
>   </Sections>

Because it violates the schema of our XML file.  The label is by far the
easier approach.  Adding an element like that would break too many pieces of
the system.


However, I've worked around the problem by delineating XPaths with special
characters, so I can specify static and dynamic text in the attribute
without having to use markup.  I now have a recursive string template that
picks out the pieces and creates the result tree correctly.

Thanks for all the feedback,
Scott



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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-2013 All Rights Reserved.