This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mystery #3: rendering embedded HTML


Hi Gary,
> The new error says the contents of that <envelope> is invalid:
>
>   org.xml.sax.SAXException: Ill-formed XML document (multiple root
>   elements detected)
>
> which is true if value-of is parsing the string.  

xsl:value-of never parses anything, all it does is give the string
value of the result of evaluating an expression.

The error that you're getting is complaining about multiple elements
at the top level of one of the documents that you're using -- my guess
would be that either the source document or the stylesheet is not well
formed. Use an XML parser or an XML editor to show you where the
well-formedness error occurs. Or, if you can't work it out, again you
can feel free to post the problem files here or to me directly.

I tested the sample file that you sent with your stylesheet, adding
disable-output-escaping:

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

<xsl:output indent="yes"/>

<xsl:template match="/">
  <h3>
    <xsl:value-of select="sports-content/sports-metadata/sports-title"/>
  </h3>
  <xsl:value-of disable-output-escaping="yes"
                select="sports-content/sports-event/highlight"/>
</xsl:template>

</xsl:stylesheet>
---

I tested using Saxon, MSXML3 or 4, Xalan J or C++, and libxslt. All of
them ran just fine, and generated the output that you'd expect:

---
<h3>Recap: Phoenix vs. Minnesota</h3>

 (Sports  Network) - The Phoenix Coyotes hope to wrap up a playoff spot tonight

<P>
 when they welcome the Minnesota Wild to America West Arena.
 
<P>
 With  91 points, the Coyotes are eighth in the Western Conference -- one ahead
 of  the Edmonton  Oilers and one behind the Vancouver Canucks. Should they top
 the  Wild this  evening and  the  Oilers fall  in regulation  to Calgary,  the
 Coyotes would end their one-year playoff drought.
---

I suppose that you might be getting an error if you were treating the
result as XML because this result isn't well-formed. But you're not
doing that, are you?

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]