This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Frames in XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Frames in XML" Watch "Frames in XML" New topic

Frames in XML

adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi All,
I want to use frames in my XML.Actually the frame content is set in a request attribute.
I want to display a frame in an XML using XSLT.Has anyone done something like this.

I have a report which is displayed in XML format using a XSLT.
I want to add a image in a frame at the top of this XML file.
How can I add a frame to an XSLT.
The frame will contain a map object.The url of the map object will be set in a request attribute.

Can anyone give me a suggestion as to how to include a frame in an XSLT.

Thanks in advance...
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
You can't use "frames" in XML. That's purely an HTML concept.
In other words, you first need to figure out what kind of HTML files you want to generate,and then figure out what kind of XSLT stylesheets you need to transform your XML document into those HTML files.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
OK how can I use an image whose location is a URL on the web?
This image is dynamically fetched from the web..
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

As you normally would in HTML (I'm assuming this is the destination format since you mention frames) - with an <img /> tag where the src attribute is the URL of that image.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi ,
My XML is something like this


I am using the following XSL
<img width="350" height="350">
<xsl:attribute name="src"><xsl:value-of select="Source"/></xsl:attribute>

But the image doesnot get displayed.
When I do a view source
I get <img height="350" width="350" src=""/>
The url is not replaced can some one tell me where I am going wrong?

Thanks a lot to all who have replied till now.
Hope to get u r cooperation ..
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150

<img width="350" height="350">
<xsl:attribute name="src"><xsl:value-of select="//*/Source"/></xsl:attribute>
<img width="350" height="350">
<xsl:attribute name="src"><xsl:value-of select="MapImage/Source"/></xsl:attribute>
<img width="350" height="350">
<xsl:attribute name="src"><xsl:value-of select="./Source"/></xsl:attribute>

its all depends on how you call the template and from what node.

Check this xpath/xsl tutorial from , pretty good.

Spritle Software Blogs
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Thanks a lot Balaji the first option has worked.I have not yet figured why?
I will try as of now I had to get it started working.
Thanks a lot for your help.
I agree. Here's the link:
subject: Frames in XML
Similar Threads
toolbar in internalframe
How to use character map stored in a separate file in my XSL?
Display two Frames In One Window?
using req:setAttribute
Frames with Tiles