You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2002/12/12 08:09:36 UTC

Converting & to & in HTML output...

I would appreciate some help with the following problem. 
 
The input of this XML fragment (partially auto-generated
from an xsp:request): 
 
<page>
  <svg-graph
src="graph/graph_WQ.svg?point=1&amp;endyr=2002&amp;varid=1">
  </svg-graph>
</page>
 

To this stylesheet fragment:
 
<xsl:template match="page/svg-graph">
  <div align="left">
  <embed pluginspage="http:///www.adobe.com/svg/viewer/install/"
type="image/svg-xml"
   width="500" height="300" name="SCVEmbed"
   src="{@src}"/>
  </div>
  <a><xsl:attribute name="href"><xsl:value-of
select="@src"/></xsl:attribute>Link</a>
</xsl:template>
 

Yields this output (via a HTML-serialized pipeline):
 
<div align="left">
 <embed pluginspage="http:///www.adobe.com/svg/viewer/install/"
type="image/svg-xml" 
 width="500" height="300" name="SCVEmbed" 
 src="graph/graph_WQ.svg?point=1&amp;endyr=2002&amp;varid=1"/>
</div>
<a href="graph/graph_WQ.svg?point=1&endyr=2002&varid=1">Link</a>
 

In order for the embedded SVG to work properly, the &amp;
in the "src" attributes needs to be converted to a conventional &.
 
I am not sure why the conversion happens for the <a> 
element and not for the <embed> one, but I would appreciate 
any ideas as to how make this happen?!
 
Thanks
Derek
 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Converting & to & in HTML output...

Posted by Joerg Heinicke <jo...@gmx.de>.
Hi Derek,

> Yields this output (via a HTML-serialized pipeline):
>  
> <div align="left">
>  <embed pluginspage="http:///www.adobe.com/svg/viewer/install/"
> type="image/svg-xml" 
>  width="500" height="300" name="SCVEmbed" 
>  src="graph/graph_WQ.svg?point=1&amp;endyr=2002&amp;varid=1"/>

the above is correct,

> </div>
> <a href="graph/graph_WQ.svg?point=1&endyr=2002&varid=1">Link</a>

but this is wrong. URLs in HTML must also be escaped. & in URLs is an 
error in theory, but browsers are mostly so convenient to resolve the 
URLs into a correct way.

Joerg


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>