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

Re: transforming to xsl: way to avoid tons of &lt and

Subject: Re: transforming to xsl: way to avoid tons of &lt and &gt?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 4 Jul 2002 11:24:33 +0100
avoid lt
Hi Richard,

> I have to transform to xslfo. That is, I take e.g. test.xml,
> transform with test.xsl, and the result has to be a new xsl file
> (test.fo), but full of tags from the xslfo namespace.
>
> So that means lots of xslfo tags in test.xsl; which means -- unless
> someone knows a way around this -- writing all the tags as e.g.
> &lt;simple-page-master&gt;. Ugly and tedious. Is there some xsl
> escape command or something that will allow me to type eg
> <single-page-master> instead in test.xsl?

Perhaps I've misunderstood what you're doing, but that's the way that
XSLT is designed to work. Make sure that your output method is 'xml'
rather than 'text', and any elements that aren't in the XSLT namespace
will be added to the output. Try:

<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 method="xml" indent="yes" />

<xsl:template match="/">
  <fo:root>
    <fo:layout-master-set>
      <fo:simple-page-master master-name="page">
        ...
      </fo:simple-page-master>
    </fo:layout-master-set>
    ...
  </fo:root>
</xsl:template>
                
</xsl:stylesheet>

For example. The only time that you need to use &lt;foo&gt; to output
a tag is if you're generating some non-well-formed XML (i.e. something
that isn't actually XML, such as non-XML-syntax JSP or ASP).

> Note: in test.fo, I will have eg <single-page-master> instead of
> <fo:single-page-master>, because I will make the fo namespace the
> default namespace in test.fo. Just to save more typing; this
> shouldn't affect my main problem here.

If you care about the prefix, you can usually fix that in the
stylesheet as well, by making the XSL-FO namespace the default
namespace:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns="http://www.w3.org/1999/XSL/Format">

<xsl:output method="xml" indent="yes" />

<xsl:template match="/">
  <root>
    <layout-master-set>
      <simple-page-master master-name="page">
        ...
      </simple-page-master>
    </layout-master-set>
    ...
  </root>
</xsl:template>
                
</xsl:stylesheet>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 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.