This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: hoe to use "(" within a variable
- From: Vinoth Palaniappan <vinoth at mihy dot mot dot com>
- To: Sergey Groznyh <gsm at fct dot ru>, xsl-list at lists dot mulberrytech dot com
- Date: Wed, 14 Aug 2002 08:31:19 +0530
- Subject: RE: [xsl] hoe to use "(" within a variable
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Sergey,
You said "...and allow simple external processor to serialize
resulting XML to actual C code." Kindly let me know what is the external
processor i can use for doing such a job. Thank you!
____________________________________________________________________________
___________
Vinoth
iDEN OMC Software, GSG
Motorola, India
voice: 91-040-3308090 extn:3208
____________________________________________________________________________
___________
>-----Original Message-----
>From: Sergey Groznyh [mailto:gsm@fct.ru]
>Sent: Tuesday, August 13, 2002 12:49 PM
>To: xsl-list@lists.mulberrytech.com
>Cc: Vinoth Palaniappan
>Subject: Re: [xsl] hoe to use "(" within a variable
>
>
>>>>>> "Jeni" == Jeni Tennison <jeni@jenitennison.com> writes:
>
> Jeni> use single quotes, as follows:
>
> Jeni> <xsl:variable name="entering_log"
> Jeni> select=''sprintf(log_str, "\n%s: %d: %s: %s", __FILE__,
> Jeni> __LINE__, fn, "Entering"); log_func();'' />
>
> Jeni> or you could use double quotes and escape the double quotes
> Jeni> in the attribute value, as follows:
>
> Jeni> <xsl:variable name="entering_log" select="'sprintf(log_str,
> Jeni> "\n%s: %d: %s: %s", __FILE__, __LINE__, fn,
> Jeni> "Entering"); log_func();'" />
>
>Also, it's almost always a bad idea to generate code in some language
>*directly* from XSLT: you will always have to escape things, and as a
>result, XSLT code will not look very readable. Instead, you may
>represent output as a [subset of] target language grammar, like this:
>
> <stmtseq>
> <stmt>
> <funcall>
> <name>sprintf</name>
> <arglist>
> <arg type="ident">log_str</arg>
> <arg type="string">\n%s: %d: %s: %s</arg>
> <arg type="ident">__FILE__</arg>
> <arg type="ident">__LINE__</arg>
> <arg type="ident">fn</arg>
> <arg type="string">Entering</arg>
> </arglist>
> </funcall>
> </stmt>
> <stmt>
> <funcall>
> <name>log_func</name>
> <void />
> </funcall>
> </stmt>
> </stmtseq>
>
>and allow simple external processor to serialize resulting XML to
>actual C code.
>
>--
>SM Groznyh "Under the wide and heavy VAX
>gsm@fct.ru Dig my grave and let me
>relax..."
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list