You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christoph Strehl <st...@itc-dortmund.de> on 2003/09/18 15:36:00 UTC

XML2HTML

Hello there,
 
I am new to Cocoon and I am already having problems with my first
example. I am trying to convert a XML file to HTML. My XML-file looks -
simplified - like this:
 
<para>
 Text with picture 
 <pic>source.jpg</pic> 
 and some text.
</para>     
 
The xsl-file is this one:
 
  <xsl:template match="pic">
    <img src="<xsl:apply-templates/>"/>
  </xsl:template>
 
I hoped to get an ouput like <img src="source.jpg"/>, instead I get a
resource-not-found-error when trying to call the page which doesn't help
me at all to find the error.
 
Thanks,
Christoph
 

Re: XML2HTML

Posted by Alexander Schatten <al...@gmx.at>.
Christian Haul wrote:

>On 18.Sep.2003 -- 03:36 PM, Christoph Strehl wrote:
>  
>
>>Hello there,
>> 
>>I am new to Cocoon and I am already having problems with my first
>>example. I am trying to convert a XML file to HTML. My XML-file looks -
>>simplified - like this:
>> 
>><para>
>> Text with picture 
>> <pic>source.jpg</pic> 
>> and some text.
>></para>     
>> 
>>The xsl-file is this one:
>> 
>>  <xsl:template match="pic">
>>    <img src="<xsl:apply-templates/>"/>
>>  </xsl:template>
>> 
>>I hoped to get an ouput like <img src="source.jpg"/>, instead I get a
>>resource-not-found-error when trying to call the page which doesn't help
>>me at all to find the error.
>>    
>>
>
>Your XSLT is not valid. You may not put an element inside an
>attribute.
>
>   <img>
>      <xsl:attribute name="src">
>        <xsl:apply-templates/><!-- better: xsl:value-of select="." -->
>      <xsl:/attribute>
>   </img>
>
>  
>
or easier:

  <xsl:template match="pic">
    <img src="{.}"/>
  </xsl:template>

Alex





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XML2HTML

Posted by Christian Haul <ha...@dvs1.informatik.tu-darmstadt.de>.
On 18.Sep.2003 -- 03:36 PM, Christoph Strehl wrote:
> Hello there,
>  
> I am new to Cocoon and I am already having problems with my first
> example. I am trying to convert a XML file to HTML. My XML-file looks -
> simplified - like this:
>  
> <para>
>  Text with picture 
>  <pic>source.jpg</pic> 
>  and some text.
> </para>     
>  
> The xsl-file is this one:
>  
>   <xsl:template match="pic">
>     <img src="<xsl:apply-templates/>"/>
>   </xsl:template>
>  
> I hoped to get an ouput like <img src="source.jpg"/>, instead I get a
> resource-not-found-error when trying to call the page which doesn't help
> me at all to find the error.

Your XSLT is not valid. You may not put an element inside an
attribute.

   <img>
      <xsl:attribute name="src">
        <xsl:apply-templates/><!-- better: xsl:value-of select="." -->
      <xsl:/attribute>
   </img>

XSL questions are best asked on specialized lists and are OT here.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org