Click to See Complete Forum and Search --> : path


amel
08-31-2003, 12:32 PM
i have a big problem: it is when i have a path (chemin) data in xml document such as pictures wich is in the hard disk, i can't reload the view (aperçu) with a xslt page it can't be reloaded?

lillu
08-31-2003, 03:45 PM
Hi,

Yes it can be done with XSLT, though you did not specify how you're trying to accomplish this. The easiest way is to use xsl:element to create an HTML img tag then display images from your hard disk.

The xml file (I called it gallery.xml)

<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="gallery.xsl"?>
<gallery>
<topic>Image Gallery</topic>
<picture>
<description>Description for Image 1.</description>
<image>1.gif</image>
</picture>
<picture>
<description>Description for Image 2.</description>
<image>2.gif</image>
</picture>
</gallery>

The xsl file (I called it gallery.xsl)

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />
<xsl:template match="/">
<html>
<head>
<title>My Image Gallery</title>
</head>
<body>
<h3>
<xsl:value-of select="gallery/topic"/>
</h3>
<xsl:for-each select="gallery/picture">

<xsl:value-of select="description"/>
<br />
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="image"/>
</xsl:attribute>
</xsl:element>
<br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

OhLordy
09-25-2003, 08:40 AM
I can't seem to get this code to run under Opera 7.11 or Netscape 7.1 in fact I can only view it correctly in IE 6.0

Khalid Ali
09-25-2003, 09:04 AM
I could be wrong,but I dont think Opera has a built in processor for XML file rendering,It should have worked for NS though.

lillu
09-25-2003, 09:13 AM
Opera 7 can parse and display XML documents.

Opera does not support XSL formatting objects or
XSLT transformations.

Netscape 7 supports XML. Not sure about xslt.

Try to get an xslt parser to work with your browsers.