RE: [xsl] XML -> HTML with paragraphs - Converting from WD to current version

Subject: RE: [xsl] XML -> HTML with paragraphs - Converting from WD to current version
From: "Joshua Miller" <josh.miller@xxxxxxxxxxxx>
Date: Mon, 10 Sep 2001 17:13:19 -0400
Thanks, this is what I need, however here's my dilemma: I'm not an XML
expert by ANY stretch of the imagination. The code I have now uses:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";> which I know is
Working Draft version.

The code I have now:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match="help/toc/item">

	<a name="top"></a>
	<h1><xsl:value-of select="@title"/></h1><br/>
	<xsl:copy-of select="helpfile"/>
	<br/><br/>

</xsl:template>
</xsl:stylesheet>

I'm using ColdFusion and COM to pass a parameter selecting a SPECIFIC item
using: help/toc/item[@id='#variable#']. SO, with my limited knowledge of
XML/XSL, how would I convert this to the current XSL draft and make it
output the HTML contained in the <helpfile> element?

The HTML in <helpfile> is well-formed by the way, so that shouldn't be
causing my errors. The biggest problem is that it doesn't return ANYTHING
when it doesn't work, so there's no error to try and correct, I feel like
I'm shooting in the dark here.

THANKS FOR ANY HELP!!!!!

Joshua Miller
Web Development::Programming
Eagle Technologies Group, Inc.
www.eagletgi.com
josh.miller@xxxxxxxxxxxx

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Sullivan, Dan
Sent: Monday, September 10, 2001 3:26 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] XML -> HTML with paragraphs


If I understand what you want, you have something like this:

<item title="Searching the Site" id="2">
	<helpfile>
    <p>Text input into paragraphs.</p>

    <p>Text input<a href="foo.htm">foo</a> into paragraphs.</p>

	</helpfile>
</item>


and you want to extract the content of <helpfile> which itself is html.
As long as the content of <helpfile> is well formed (balanced tags) then
an identity transform should do what you want. For example the following
extacts the <helpfile>


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:output method="html"/>
  <xsl:template match="node()|@*">
    <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>
  <xsl:template match="helpfile">
    <xsl:apply-templates select="node()|@*"/>
  </xsl:template>
  <xsl:template match="/">
    <html>
      <body bgcolor="#FFFFFF">
        <xsl:apply-templates select="//helpfile"/>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>


and produces:

<html>
   <body bgcolor="#FFFFFF">

      <p>Text input into paragraphs.</p>


      <p>Text input<a href="foo.htm">foo</a> into paragraphs.
      </p>


   </body>
</html>

Is this the sort of thing you are trying to do?

Dan



-----Original Message-----
From: Joshua Miller [mailto:josh.miller@xxxxxxxxxxxx]
Sent: Monday, September 10, 2001 2:59 PM
To: Xsl-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] XML -> HTML with paragraphs


I have an XML document with the following structure:

<item title="Searching the Site" id="2">
	<helpfile>
		Text input into paragraphs.

		Text input into paragraphs.

	</helpfile>
</item>

And I want to display the contents of <helpfile> as HTML with <p> tags
to
separate the paragraphs. However, I can't seem to make this work. I've
tried
adding <p> tags to the text (yeah, I know, this doesn't work).

What I really need to know I guess, is how to put HTML into an XML
document
and make it display as HTML and not as escaped html (&gt;/&lt;) ... is
this
even possible? I want to store helpfile information in an XML document,
but
I need figures and links and images in the output ... how do I make this
work? Or is XML not the answer here?

Joshua Miller
Web Development::Programming
Eagle Technologies Group, Inc.
www.eagletgi.com
josh.miller@xxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread