You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yatin Shah <no...@kripa.com> on 2003/02/13 01:39:07 UTC

Dynamic XSL evaluation

My application access DB for content(Using SQL Transformer) which later 
gets transformed into HTML via xml2html transformer.
For example, I have following sniippet in my xml2html transformer:
    <xsl:variable name="welcome_title" 
select="//welcome/sql:rowset/sql:row/sql:title"/>
    <p>
        <xsl:value-of select="$welcome_title"/>
    </p>

This works fine.
If the welcome_title was "<b> Hello. Welcome to Acme, Inc. &lt;/b&gt;"
Then the embeded HTML code is not interperted as HTML tags.
Regardless of how it's embeded in the data(as <b> or as &lt;b&gt;) it is 
included as it was embeded.

What I like to do is to dynamically evaluate the content of 
$welcome_title so that embeded HTML tags are detected and parsed as:
    <p>
        <b>
            Hello. Welcome to Acme, Inc.
        </b>
    </p>

Even better would be to be able to include any XML tags and have it 
dynamically evaluated by the xml2html transformer.
Any one have any ideas?
Thanks for your help.
-Yatin


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Dynamic XSL evaluation

Posted by Yatin Shah <no...@kripa.com>.
Idhaya, thanks for help. Although the solution is incorrect.
I'll agree with J.Pietschmann, I don't think a simple solution exists!
I think the reasoning is ...
the welcome_title variable is holding a text value and it's not a node set.
text value can not be processed like a node set.

Only hope, I think is with the SQL Transformer. Instead of just laying
the text it should lay the full node set if the sql column value has any 
embeded tags!

-Yatin


J.Pietschmann wrote:

> Idhaya Chandran wrote:
>
>> You can use <xsl:value-of select="{$welcome_title}"/>
>
>
> That's a bad idea. This is a syntax error.
>
>
> >From: Yatin Shah [mailto:nospam@kripa.com]
>
>>> If the welcome_title was "<b> Hello. Welcome to Acme, Inc. &lt;/b&gt;"
>>> Then the embeded HTML code is not interperted as HTML tags.
>>
>
> You should not put HTML snippets into a database. If you
> want to extract them with Cocoon and have them delivered
> as HTML in the output, you'll have to run them through an
> XML parser. Just forget about simple solutions.
>
> J.Pietschmann
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Dynamic XSL evaluation

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Idhaya Chandran wrote:
> You can use 
> <xsl:value-of select="{$welcome_title}"/>

That's a bad idea. This is a syntax error.


 >From: Yatin Shah [mailto:nospam@kripa.com]
>> If the welcome_title was "<b> Hello. Welcome to Acme, Inc. &lt;/b&gt;"
>> Then the embeded HTML code is not interperted as HTML tags.

You should not put HTML snippets into a database. If you
want to extract them with Cocoon and have them delivered
as HTML in the output, you'll have to run them through an
XML parser. Just forget about simple solutions.

J.Pietschmann


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: Dynamic XSL evaluation

Posted by Idhaya Chandran <id...@coreobjects.com>.
You can use 
<xsl:value-of select="{$welcome_title}"/>
instead of 
<xsl:value-of select="$welcome_title"/>

--Idhaya
-----Original Message-----
From: Yatin Shah [mailto:nospam@kripa.com]
Sent: Thursday, February 13, 2003 6:09 AM
To: cocoon-users@xml.apache.org
Subject: Dynamic XSL evaluation


My application access DB for content(Using SQL Transformer) which later 
gets transformed into HTML via xml2html transformer.
For example, I have following sniippet in my xml2html transformer:
    <xsl:variable name="welcome_title" 
select="//welcome/sql:rowset/sql:row/sql:title"/>
    <p>
        <xsl:value-of select="$welcome_title"/>
    </p>

This works fine.
If the welcome_title was "<b> Hello. Welcome to Acme, Inc. &lt;/b&gt;"
Then the embeded HTML code is not interperted as HTML tags.
Regardless of how it's embeded in the data(as <b> or as &lt;b&gt;) it is 
included as it was embeded.

What I like to do is to dynamically evaluate the content of 
$welcome_title so that embeded HTML tags are detected and parsed as:
    <p>
        <b>
            Hello. Welcome to Acme, Inc.
        </b>
    </p>

Even better would be to be able to include any XML tags and have it 
dynamically evaluated by the xml2html transformer.
Any one have any ideas?
Thanks for your help.
-Yatin


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>