image and CSS location for internal browser

Having trouble installing Oxygen? Got a bug to report? Post it all here.
nmshah
Posts: 16
Joined: Sun Nov 13, 2005 6:43 am

image and CSS location for internal browser

Post by nmshah »

After transformation when my result opens in the internal browser, it doesn't load any images and CSS.

I saw in the documentation on the website that there is supposed to be a text box to specify location of images if you select XHTML checkbox in the output box - but I don't have that textbox in the scenario config dialog below the XHTML checkbox in the output tab

I'm using eclipse 3.1.1 and oxygen 6.2.6

anybody know the fix?

thanks
Nilesh
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

The textbox for image location is available only in the standalone distribution because the Eclipse view used for displaying the transformation result does not support setting the base location. We will correct the User Manual. In Eclipse the images with relative locations will not be displayed so if you want to see them you have to use absolute locations.

Regards,
Sorin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

The fact that we can't set a base location for the relative locations is a limitation of the Eclipse view used to display the result. We added a bug on our bugzilla to try to implement a fix for this limitation.

Regards,
Sorin
nmshah
Posts: 16
Joined: Sun Nov 13, 2005 6:43 am

Post by nmshah »

Thanks. I tried looking for help in the eclipse area also - but so far no luck. Their internal view must be opening file w.r.t some directory. I tried %TMP%, eclispse install dir and the workspace directory but it doesn't seem to be using any of those.

I know that stylus studio product that I use always generates the result file in the TMP directory so I copy all my images and CSS in TMP folde for the internal view in that product to work correctly

If anybody knows which directory eclipse uses as a working dir for internal browser, I can copy my images and CSS in that dir for it to work. I'll wait for your team to find a workaround

Regards
Nilesh
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Workaround for relative paths in the HTML transform result

Post by sorin_ristache »

Hi Nilesh,
nmshah wrote:I'll wait for your team to find a workaround
Add the following XSLT stylesheet to the <oXygen/> transformation scenario as additional stylesheet which will post-process the XHTML output of your stylesheet (DocBook XSL, etc.). You have to use the Additional XSLT stylesheets button in the scenario edit dialog. Make sure the output of your stylesheet is well-formed XML.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="baseURI"/>

<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@*[not(self::style)]"/>
<xsl:apply-templates select="@style" mode="makeAbsolute"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="img">
<xsl:copy>
<xsl:apply-templates select="@*[not(self::src)]"/>
<xsl:apply-templates select="@src" mode="makeAbsolute"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="link">
<xsl:copy>
<xsl:apply-templates select="@*[not(self::href)]"/>
<xsl:apply-templates select="@href" mode="makeAbsolute"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@src | @style | @href" mode="makeAbsolute">
<xsl:attribute name="src">
<xsl:choose>
<!-- test for absolute locations -->
<xsl:when test="
starts-with(., 'http://') or
starts-with(., 'ftp://') or
starts-with(., 'https://') or
starts-with(., 'ftps://') or
starts-with(., 'file:/') or
starts-with(., '/')
">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($baseURI, '/', .)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Also add the following parameter using the Parameters button of the same dialog: parameter name - baseURI and parameter value - the base URI for the relative locations which point to the image files and CSS file(s) in the HTML output, for example file:/C:/temp/result where C:/temp/result is a directory on your hard disk. The stylesheet will leave the absolute paths unchanged in the output of your stylesheet and will replace any relative path, for example path1 with value of baseURI param + "/" + path1.

Best regards,
Sorin
nmshah
Posts: 16
Joined: Sun Nov 13, 2005 6:43 am

Post by nmshah »

Hi Sorin,

I would like our XSL output to be XHTML and be able to cascade through this XSL to use the baseURI parameter, but for now our XSL generate Transitional HTML and this approach doesn't work in that case as the output won't be well-formed XML

Is there no way for oxygen to generate the output HTML in a known location for eclipse to show in the integrated browser?

I don't have to use eclipse, but the reason I use eclipse is because the integrated browser of stand-alone oxygen doesn't render HTML correctly. Eclipse seems to be using Mozilla (on linux). Is there a way I can make standalone oxygen use Mozilla as integrated browser (on windows and linux)

thanks
Nilesh
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

You can't set a browser for the internal view of <oXygen/> standalone. You should open the transform result in an external browser by setting Open in browser in the scenario.

Regards,
Sorin
Post Reply