logo       

Re: Mixed content from a textarea: msg#00117

Subject: Re: Mixed content from a textarea
Zach Roberts wrote:

I love to respond to my own posts, so here goes an update.

I have just recently discovered the disable-output-escaping attribute for an xsl:value-of element. So far, this looks to be providing what I need, So, attached is an updated mixed_html.xsl which uses this attribute to correctly. I am still interested in ideas about the "best" way to do this, so if you have any to contribute, please share.
thanks for the investigation and your solution so far. still have to review it and then like to apply it as first solution for now.




Zach



Zach Roberts wrote:

This was bouncing back from sourceforge, so I have included the files unzipped. Sorry for the duplicates if the original message got through.
yes. zip files will bounce but you can use gz instead.


Joern


Hello Dev List,

I am sure that some of you have come across this situation before, so I
would like to pick your collective brains for some suggestions.  The
situation is that I need to allow for mixed content (specifically HTML
tags) to be entered into a textarea in an xform.  When chiba stores this
instance XML, all '<' and '>' and other symbols are translated
appropriately to entities (into &lt; and &gt; and so on) to allow for
processing and storage as valid XML.   This is causing issues later
because I would like the mixed content to be kept intact when the
instance XML is later processed through XSLT.  Now, I can get the XSLT
to pick up the exact contents using the copy-of element, but that leaves
the mixed content in its raw XML state of &lt; and &gt;.  I could hack
something together in a different language which did a string replace
for all those entities which I expect, but I am really hoping that I am
just missing the obvious easy way to do this.  Any ideas?  As a test, I
have attached a simple XForm, XML instance, XSL to run it through, and
resulting HTML, just in case my description is not clear enough to see
what I am trying to accomplish.  Thanks,

Zach Roberts




------------------------------------------------------------------------

test <b>test bold text</b> end test

------------------------------------------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/mixed">
    <html xmlns='http://www.w3.org/TR/html401'>
        <head>
            <title>Mixed Content Instance HTML</title>
        </head>
            <body>
                <xsl:copy-of select="content" />
            </body>
    </html>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<html xml:base="http://localhost:8000/chiba-0.9.4/";
    xmlns="http://www.w3.org/2002/06/xhtml2";
    xmlns:chiba="http://chiba.sourceforge.net/2003/08/xforms";
    xmlns:xforms="http://www.w3.org/2002/xforms";
    xmlns:xlink="http://www.w3.org/1999/xlink";>
    <head>
        <xforms:model id="mixed-model">
            <xforms:instance id="mixed-instance">
                <mixed><content/></mixed>
            </xforms:instance>
<xforms:submission id="submission-debug" xforms:action="jsp/return-instance.jsp" xforms:method="post" xforms:replace="all"/>
            <xforms:bind id="bind-mixed" xforms:nodeset="/mixed">
<xforms:bind id="bind-mixed-content" xforms:nodeset="content" />
            </xforms:bind>
        </xforms:model>
        <xforms:model id="mixed-labels">
            <xforms:instance id="mixed-label-names">
                <labels>
                    <mixed>Mixed</mixed>
                    <mixed-content>Add Content</mixed-content>
                    <debug>Debug</debug>
                </labels>
            </xforms:instance>
        </xforms:model>
    </head>
    <body>
<xforms:textarea id="input-mixed-content" xforms:bind="bind-mixed-content"> <xforms:label xforms:model="mixed-labels" xforms:ref="/labels/mixed-content"/>
        </xforms:textarea>
        <xforms:group appearance="minimal" id="group-buttons">
            <xforms:trigger id="trigger-debug">
<xforms:label xforms:model="mixed-labels" xforms:ref="/labels/debug"/>
                <xforms:action id="action-debug">
<xforms:send id="send-debug" xforms:submission="submission-debug"/>
                </xforms:action>
            </xforms:trigger>
        </xforms:group>
    </body>
</html>
------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<mixed><content>test &lt;b&gt;test bold text&lt;/b&gt; end test</content></mixed>


------------------------------------------------------------------------

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:template match="/mixed">
        <html xmlns='http://www.w3.org/TR/html401'>
                <head>
                        <title>Mixed Content Instance HTML</title>
                </head>
                        <body>
                                <xsl:value-of select="content" 
disable-output-escaping="yes" />
                        </body>
        </html>
</xsl:template>
</xsl:stylesheet>



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe