How to preview locally-saved images in the XML Preview window of Studio?

Hi,

How can I do to see the images (that are saved in a folder of my Desktop) of my XML source file in the XML Preview window of Studio?

The English source XML file contains Facebook posts and local links to images. The XML source file has a stylesheet.xsl and I created a customized XML file type in Studio.

Thank you in advance for your help on this.

Best regards,

Carla

Parents
  • Hi ,

    Thanks for sending me the file and for posting your question in here. I'll send you an updated stylesheet that you can play with to get the size of the images correct. All I did was change your syntax calling the image and added a new template. I deleted this:

    <img><xsl:attribute name="href"><xsl:value-of select="Image"/></xsl:attribute></img>

    Then replaced it with this:

    <xsl:apply-templates select="Image" />

    And added this at the end:

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

    This then worked. Now I'm no expert of the creation of stylesheets so I can't really explain a lot about this, I just recall doing a similar exercise that took me a while to figure out and this is the solution that worked for me. Hope it helps.

    Regards

    Paul

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Hi Paul, 

    Thank for coming back to me so quickly. I'm not sure I got it right. So, when you have a moment, please send me the updated stylesheet by email.

    Thank you!

    Best regards,

    Carla 

  • Do you mean like this?

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="www.w3.org/.../Transform">
    <xsl:output method="html" />
    <xsl:template match="/">
    <html>
    <body>
    <table border="0">
    <tr>
    <td><h3>FaceBook Posts</h3></td>
    </tr>
    </table>
    <table border="1">
    <tr bgcolor="#009966">
    <th>Image Number</th>
    <th>Image</th>
    <th>Post</th>
    </tr>
    <xsl:for-each select="data-set/Post">
    <tr>
    <td width="5%"><b><font color="#380000" size="3"><xsl:value-of select="ImageNumber"/></font></b></td>
    <td width="40%"><xsl:apply-templates select="Image"/></td>
    <td width="60%"><font color="#0000FF" size="2"><xsl:value-of select="SourcePost"/></font></td>
    </tr>
    </xsl:for-each>
    </table>
    </body>
    </html>
    </xsl:template>
    <xsl:template match="Image">
    <img src="{.}" />
    </xsl:template>
    </xsl:stylesheet>

  • Hi  

    That's exactly what I meant.  Aplogies for not sending your files yet but I can't get this to work in Studio correctly with your files so have asked for some advice that a little slow coming!

    Your original stylesheet didn't work for me at all, even in my testing application.  So I changed it as above and now that works.  But it's not working in Studio as I'm seeing a central directory error that I can't figure out.  Once the development team have time to get back to me I'll know better what the problem is.

    I have attached an example of one that works in case you want to consider revising the way you handled this in general and then you might be able to move forward.

    Files.zip

    It could be that a slightly different approach, if you have control over the data and it looks as though you do, might work for you.

    Regards

    Paul

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Reply
  • Hi  

    That's exactly what I meant.  Aplogies for not sending your files yet but I can't get this to work in Studio correctly with your files so have asked for some advice that a little slow coming!

    Your original stylesheet didn't work for me at all, even in my testing application.  So I changed it as above and now that works.  But it's not working in Studio as I'm seeing a central directory error that I can't figure out.  Once the development team have time to get back to me I'll know better what the problem is.

    I have attached an example of one that works in case you want to consider revising the way you handled this in general and then you might be able to move forward.

    Files.zip

    It could be that a slightly different approach, if you have control over the data and it looks as though you do, might work for you.

    Regards

    Paul

    Paul Filkin | RWS Group

    ________________________
    Design your own training!

    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

Children