cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Upayavira ...@upaya.co.uk>
Subject Re: Openoffice generator
Date Tue, 03 Feb 2004 12:47:19 GMT
Zamek wrote:

>Hello,
>
>On Tuesday 03 February 2004 12.59, Upayavira wrote:
>  
>
>>Zamek wrote:
>>    
>>
>>>On Tuesday 03 February 2004 10.33, Upayavira wrote:
>>>      
>>>
>>>>Zamek wrote:
>>>>        
>>>>
>>>>>How can I translate #Pictures/nnn.png to document_name/nnn.png in xsl?
>>>>>          
>>>>>
>>>><img src="document_name/{substring-after(@xlink:href,'#Pictures/')}/>
>>>>        
>>>>
>>>As you can see I am not an xml expert :-(
>>>
>>>Its result is:
>>><img src="document_name/10000000000002F40000022DB4BA1A68.png"
>>>alt="Graphic1">
>>>
>>>xsl template is:
>>>
>>><xsl:template match="//draw:image">
>>> <img alt="{@draw:name}"
>>>src="document_name/{substring-after(@xlink:href,'#Pictures/')}"/>
>>></xsl:template>
>>>
>>>It is closed to successfully, it need to retrive name of document only.
>>>      
>>>
>>Sorry, I don't understand. It seems that the code has done what I
>>intended. What are you trying to achieve instead?
>>    
>>
>
>For example I have an oo document named voiceip.sxw. I has a lot of image in 
>it. Image refrences is like #Pictures/nnnnnnn.png are relative links inside 
>this document. 
>
>I can get images in my sitemap.xmap like:
>
>      <map:match pattern="*/*.png">
>        <map:read src="zip://Pictures/{2}.png@{1}" mime-type="image/png"/>
>      </map:match>
>
>in ooo2html.xsl template need to be convert images to this format.
>
>At this example: voiceip.sxw/nnnnnn.png
>
>Original tempalte cannot retrive pictures:
>
><xsl:template match="//draw:image">
> <img alt="{@draw:name}" src="{@xlink:href}" /> 
></xsl:template>
>
>because its result is #Pictures/nnnnnnnn.png
>
>your templates seems to be good, but it cannot retrieve name of document. 
>
>Your template's result is document_name/nnnnnnn.png instead of 
>voiceip.sxw/nnnnnnnnn.png. 
>
>  
>
So you need to pass the name of the document from the sitemap to the XSLT:

<map:match pattern="*.xsw">
  ...
  <map:transform src="ooo2html.xsl">
    <map:parameter name="doc_name" value="{1}"/>
  </map:transform>
  ...
</map:match>

Then in oo2html.xsl:
<xsl:stylesheet .......>
  <xsl:param name="doc_name"/>
  ...
  <xsl:template match=.......>

    <img src="{$doc_name}/{substring-after(@xlink:href,'#Pictures/')}/>


Regards, Upayavira



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


Mime
View raw message