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.
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.
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 < and > 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 < and >. 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 <b>test bold text</b> 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>
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|