Subject: RE: [xsl] Cold Fusion From: "Christine Stamatis (s)" <cstamat@xxxxxxx> Date: Fri, 14 Mar 2003 10:17:13 -0600 |
That's exactly what I'm trying to do. My error, I didn't submit my initial inquiry properly. I've been given an existing set of xsl/xml files which render html versions. I've been asked to tweak the xsl in order to produce a .cfm rendition. When I edit the xsl file in XMLSpy, I get the following validation error message: "This file is not well-formed: =expected after (CFIF IsDefined)" <!DOCTYPE Policy [ <!ENTITY nbsp " "> <!ENTITY reg "®"> <!ENTITY mdash "—"> <!ENTITY lf " "> <!ENTITY cr " "> <!ENTITY trade "™"> <!ENTITY copy "©"> ]> <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="html" encoding="UTF-8" indent="yes" media-type="text/html"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <!-- If this is a WebPublisher page the top-level element should always be called 'content" --> <xsl:template match="content"> <CFIF IsDefined ("Cookie.ChocolateChip")> <cfinclude template="/CheckLogin.cfm"> </cfinclude> (The following is placed in the bottom of the document) <cfelse> <cflocation url="../../../notify.cfm"> </cfif> -----Original Message----- From: Mike Brown [mailto:mike@xxxxxxxx] Sent: Thursday, March 13, 2003 5:37 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Cold Fusion Alright, I guess I can try to help, under the assumption that you're trying to generate CFML with XSLT. Christine Stamatis (s) wrote: > <!--- <CFIF IsDefined("URL.sys")> ---> To generate a comment in XSLT, you need to use <xsl:comment>...</xsl:comment> > <CFIF IsDefined("Cookie.ChocolateChip")> > <cfinclude template="/CheckLogin.cfm"> > <!--- <CFIF #Cookie.ChocolateChip# IS #URL.sys#> ---> > <cfelse> > <cflocation url="../../../register.cfm"> > </cfif> XSLT is XML. You can't have unclosed, unbalanced tags, and case matters. CFML's syntax is so far removed from HTML and XML, you will not be able to do what you want. Consider just the cfif tag: the IsDefined("...") portion cannot be generated at all, because it is not an attribute. Even if you adjust your XSLT, the HTML serializer of an XSLT processor will not know that cfinclude, cfelse, and cflocation elements are to be written without end tags. This may be a case for the use of disable-output-escaping, where you write all your tags as XML character data and then tell the serializer to emit them without escaping the markup characters "<" and "&": <xsl:text disable-output-escaping="yes"><![CDATA[ <!--- <CFIF IsDefined("URL.sys")> ---> <CFIF IsDefined("Cookie.ChocolateChip")> <cfinclude template="/CheckLogin.cfm"> <!--- <CFIF #Cookie.ChocolateChip# IS #URL.sys#> ---> <cfelse> <cflocation url="../../../register.cfm"> </cfif> ]]></xsl:text> but this kludgy "solution" is not guaranteed to work at all (its support is optional and relies on the processor serializing the result tree directly). See also http://www.dpawson.co.uk/xsl/sect2/N2215.html My recommendation, if you must use XSLT, is to instead generate something that you can transform in an external, non-XSLT search-and-replace. <xsl:processing-instruction target="cfif"> <xsl:text>IsDefined("Cookie.ChocolateChip")</xsl:text> </xsl:processing-instruction> <xsl:text> 	</xsl:text> <xsl:processing-instruction target="cfinclude"> <xsl:text>template="/CheckLogin.cfm"</xsl:text> </xsl:processing-instruction> will generate <?cfif IsDefined("Cookie.ChocolateChip")?> <?cfinclude template="/CheckLogin.cfm"?> which you can then do a simple replacement of "<?" and "?>" (to "<" and ">") on, outside of XSLT. Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Cold Fusion, Yue Ma | Thread | Re: [xsl] Cold Fusion, Mike Brown |
RE: [xsl] White Spaces, Rod Humphris - FLPTN | Date | [xsl] HOW TO CHECK FOR EXISTENCE OF, Mike Rudolph |
Month |