Subject: Re: [xsl] transforming to xsl: way to avoid tons of < and >? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 4 Jul 2002 11:24:33 +0100 |
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. > <simple-page-master>. 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 <foo> 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] transforming to xsl: way to a, Richard Bondi | Thread | [xsl] re: transforming to xsl: way , Richard Bondi |
Re: [xsl] The Future of Browser-Bou, Francis Norton | Date | Re: [xsl] Translating grammars XML , Jeni Tennison |
Month |