Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 14th, 2007, 01:09 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL forum system

Hi everyone
I'm relatively new to xsl event though I worked with xhtml/php for some years now.

I have a concept for a forum, I want to build a forum that uses xml as it's out put so any program will be able to display it's post.
It has to have a XSL stylesheet to behave like a classic forum as well.

I'm using client side XSL
"<?xml-stylesheet type="text/xsl" href="xsl stylesheet/forum.xsl"?>"
because I belive this way my forum can achieve it's maximum speed(If the client is caching the xsl files).

But I came across a issue when I tried to display and store post text as html format.

I searched the web for many minutes and came up with a couple of solutions, none of them suited me too well. The best so far was to use copy-of instead of value-of but the problem with that is that when invalid xhtml is inside a xml node I get errors from the browser.
The information inside the node must be able to invalid since it's submitted by the users and checking if it's valid, forcing the user to make it valid is not something I want to do for obvious reasons.
I tried a couple of other syntaxes like using CDATA but it just returned the value inside replacing < with < etc.

I also tried a method using comments (surround the inner text with html comments and then cut them out in some way).
But I couldn't get it to render as html as well.

Is it possible?
What am I doing wrong?

Here's some code example:
XML output generated by php
Code:
<root>

    <users>

    <user id="12">
<name>ilyail3</name>
<avatar>open/Other/gif10.gif</avatar>

    <signature>
sign
<br/>
    <div align="right">
linkin park - 2Worlds
<br/>
ilyail3 - Site's developer
<br/>
</div>
</signature>
</user>

    <user id="13">
<name>4everevil</name>
</user>
</users>

    <parents>

    <parent>
<id>0</id>
<title>VB2005</title>
<mod>12</mod>
</parent>

    <parent>
<id>1</id>
<title>Games</title>
<icon>vb2005.png</icon>
<mod>12</mod>
</parent>
</parents>

    <thr>

    <page>
<this>1</this>
<max>1</max>
</page>
<id>3</id>
<sticky>0</sticky>
<locked>0</locked>
</thr>

    <posts>

    <post title="title" skip="0">
<id>4</id>
<title>TestAgain</title>

    <content>

    <!--
You <strong>should write my name</strong><img src="include/tinymce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" />
-->
</content>
<date>290807 92907</date>
<user>12</user>
</post>

    <post skip="0">
<id>6</id>
<title>SecondPost</title>

    <content>

</content>
<date>290807 92909</date>
<user>12</user>
</post>
</posts>

    <prem>
<write>1</write>
<delete>1</delete>
<stiky>1</stiky>
<lock>0</lock>
</prem>
</root>
And here's the latest xsl instruction(which is not really working but the closest I ever got)
Code:
<xsl:copy-of select="content/comment()" disable-output-escaping="yes"/>
 
Old October 14th, 2007, 05:56 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In my opinion storing HTML in a CDATA section, and the other methods, only lead to problems later. Tidy the HTML so that it is valid XHTML and then store as true mark up. There are a number of utilities to do this including HTMLTidy. Disable output escaping is not a good option as it's a deprecated concept and will not work will all browsers, Firefox for instance.

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
A good XSL-FO forum? lthompso XSLT 3 March 22nd, 2006 06:51 AM
How can I creat a forum like P2P Forum? pcassiano ASP.NET 1.0 and 1.1 Basics 1 October 31st, 2005 05:00 AM
converting Forum.aspx to Forum.ascx (help) drfunkie BOOK: ASP.NET Website Programming Problem-Design-Solution 1 July 11th, 2003 12:27 PM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.