PDA

View Full Version : Image DTD Declaration


Scriptbanger
09-26-2006, 08:42 PM
:o Wow, searched all through the forums. This must be so simple nobody even needs to ask about it [except me]. What is the proper [or appropriate] DTD declaration to get an image to show up?

Thanks -

_Aerospace_Eng_
09-27-2006, 03:11 AM
It would help if you posted the current code you have. An image should show up no matter unless of course you are getting the filename wrong.

Scriptbanger
09-27-2006, 06:20 PM
Sorry 'bout that. Here is my code. The text shows up but the images [and the html bold tags] don't.

DTD:

<!ELEMENT NEWS ANY>
<!ELEMENT HEADLINE (#PCDATA)>
<!ELEMENT BYLINE (#PCDATA)>
<!ELEMENT AUTHOR (#PCDATA)>
<!ELEMENT DATE (#PCDATA)>
<!ELEMENT STORY (#PCDATA)>
<!ELEMENT IMAGES (#PCDATA)>


XSL

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<xsl:apply-templates select="NEWS/HEADLINE" />
<xsl:apply-templates select="NEWS/BYLINE" />
<xsl:apply-templates select="NEWS/AUTHOR" />
<xsl:apply-templates select="NEWS/DATE" />
<xsl:apply-templates select="NEWS/STORY" />
<xsl:apply-templates select="NEWS/IMAGES" />
</xsl:template>
<xsl:template match="HEADLINE">
<DIV STYLE="display:'block'; font-family:'arial'; color:'#000080'; font-weight:'600'; font-size:'22'">
<xsl:value-of />
</DIV>
</xsl:template>
<xsl:template match="BYLINE">
<DIV STYLE="display:'block'; font-family:'arial'; color:'#000080'; font-weight:'200'; font-size:'15'">
<xsl:value-of />
</DIV>
</xsl:template>
<xsl:template match="AUTHOR">
<SPAN STYLE="display:'block'; font-family:'arial'; color:'#000080'; font-weight:'100'; font-size:'10'">
<xsl:value-of />
</SPAN>
</xsl:template>

<xsl:template match="DATE">
<SPAN STYLE="display:'block'; font-family:'arial'; color:'#000080'; font-weight:'100'; font-size:'10'">
<xsl:value-of />
</SPAN>
</xsl:template>

<xsl:template match="STORY">
<DIV STYLE="display:'block'; font-family:'arial'; color:'#000080'; font-weight:'50'; font-size:'10'">
<xsl:value-of />
</DIV>
</xsl:template>

<xsl:template match="IMAGES">
<IMAGE STYLE="display:block; visibility:visible; height:auto; width:auto;">
<xsl:value-of />
</IMAGE>
</xsl:template>
</xsl:stylesheet>


XML

<?xml version="1.0" encoding="iso-8859-1"?>
<?DOCTYPE LANGLIST SYSTEM "index.dtd"?>
<?xml-stylesheet type="text/xsl" href="index.xsl"?>
<NEWS>
<HEADLINE>Big Headline Here</HEADLINE>
<BYLINE>Smaller Byline Here</BYLINE>
<AUTHOR>Author Here <DATE>Date Here</DATE></AUTHOR>
<STORY>
<b>Story Part 1 Here</b>: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec sagittis eros vitae justo. In quis felis in lectus scelerisque placerat. Vivamus ante augue, egestas ac, fermentum at, imperdiet et, pede. Donec laoreet feugiat est. Phasellus volutpat diam ac augue. Cras venenatis aliquet diam. Cras tristique nisl non tellus. Donec sagittis massa sed risus. Nullam molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam auctor, purus in pretium mattis, tellus erat pharetra nibh, ut scelerisque nibh nunc eu dui. In eget erat eu elit accumsan pulvinar. Etiam consectetuer scelerisque pede. Pellentesque eu libero et massa tincidunt accumsan. Vestibulum tristique pede quis odio.
<IMAGES>
<IMGOP type="file" src="img001.jpg"></IMGOP>
</IMAGES>
<b>Story Part 2 Here</b>: Sed lacinia. Ut diam nibh, adipiscing vel, pharetra vel, interdum non, libero. Nunc eget ante ut dolor vestibulum tempus. Sed ornare nisl suscipit neque. Fusce eros. Etiam dignissim consequat tortor. Nam ultrices dapibus odio. Integer bibendum. Etiam ut eros. Donec tempor mauris in turpis. Suspendisse luctus velit eleifend nisi. Suspendisse felis mi, porttitor at, pretium eu, vehicula eget, neque. Vivamus tincidunt, ipsum ut convallis viverra, justo diam varius justo, in posuere tortor sem at sem. Vivamus tincidunt sollicitudin dolor. Etiam suscipit ipsum quis sapien. Quisque sed massa a tellus tempus interdum. Integer sollicitudin ante quis purus. Fusce vitae urna eu quam accumsan condimentum. Proin nunc. Nam erat quam, gravida id, blandit id, fringilla sit amet, pede.
<IMAGES>
<IMGOP type="file" src="img002.jpg"></IMGOP>
</IMAGES>
<b>Story Part 3 Here</b>: Nulla justo nisi, ornare in, convallis eget, mattis vitae, quam. Proin vitae quam in orci dapibus interdum. Donec quis lacus. Praesent auctor ligula eu justo. Cras eleifend augue in urna. Nulla nunc. Integer mauris ante, mollis sed, lobortis molestie, dignissim ut, lorem. Nulla facilisi. Donec risus ipsum, mollis laoreet, porttitor vel, imperdiet porta, tellus. Praesent vitae sapien.
</STORY>
</NEWS>

Alex Vincent
09-27-2006, 09:31 PM
Shouldn't that be <!DOCTYPE NEWS SYSTEM "index.dtd"> ?

Scriptbanger
09-27-2006, 11:26 PM
Yup. I was working with an XML example and forgot to change that. It's fixed now but apparently didn't make any difference. The page still displays the same.

Fixed XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE NEWS SYSTEM "index.dtd">
<?xml-stylesheet type="text/xsl" href="index.xsl"?>
<NEWS>
<HEADLINE>Big Headline Here</HEADLINE>
<BYLINE>Smaller Byline Here</BYLINE>
<AUTHOR>Author Here <DATE>Date Here</DATE></AUTHOR>
<STORY>
<b>Story Part 1 Here</b>: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec sagittis eros vitae justo. In quis felis in lectus scelerisque placerat. Vivamus ante augue, egestas ac, fermentum at, imperdiet et, pede. Donec laoreet feugiat est. Phasellus volutpat diam ac augue. Cras venenatis aliquet diam. Cras tristique nisl non tellus. Donec sagittis massa sed risus. Nullam molestie. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Nam auctor, purus in pretium mattis, tellus erat pharetra nibh, ut scelerisque nibh nunc eu dui. In eget erat eu elit accumsan pulvinar. Etiam consectetuer scelerisque pede. Pellentesque eu libero et massa tincidunt accumsan. Vestibulum tristique pede quis odio.
<IMAGES>
<IMGOP type="file" src="img001.jpg"></IMGOP>
</IMAGES>
<b>Story Part 2 Here</b>: Sed lacinia. Ut diam nibh, adipiscing vel, pharetra vel, interdum non, libero. Nunc eget ante ut dolor vestibulum tempus. Sed ornare nisl suscipit neque. Fusce eros. Etiam dignissim consequat tortor. Nam ultrices dapibus odio. Integer bibendum. Etiam ut eros. Donec tempor mauris in turpis. Suspendisse luctus velit eleifend nisi. Suspendisse felis mi, porttitor at, pretium eu, vehicula eget, neque. Vivamus tincidunt, ipsum ut convallis viverra, justo diam varius justo, in posuere tortor sem at sem. Vivamus tincidunt sollicitudin dolor. Etiam suscipit ipsum quis sapien. Quisque sed massa a tellus tempus interdum. Integer sollicitudin ante quis purus. Fusce vitae urna eu quam accumsan condimentum. Proin nunc. Nam erat quam, gravida id, blandit id, fringilla sit amet, pede.
<IMAGES>
<IMGOP type="file" src="img002.jpg"></IMGOP>
</IMAGES>
<b>Story Part 3 Here</b>: Nulla justo nisi, ornare in, convallis eget, mattis vitae, quam. Proin vitae quam in orci dapibus interdum. Donec quis lacus. Praesent auctor ligula eu justo. Cras eleifend augue in urna. Nulla nunc. Integer mauris ante, mollis sed, lobortis molestie, dignissim ut, lorem. Nulla facilisi. Donec risus ipsum, mollis laoreet, porttitor vel, imperdiet porta, tellus. Praesent vitae sapien.
</STORY>
</NEWS>

Alex Vincent
09-28-2006, 05:58 AM
Is it outputting HTML? What's the output, post-transformation, look like? What content type is it served with?

What CSS styles the end result?

Scriptbanger
09-28-2006, 06:48 PM
Is it outputting HTML?

No. HTML markup is being ignored.


What's the output, post-transformation, look like?

The output display is correct as per the XSL except that the images aren't showing up and the HTML markup is being ignored.


What content type is it served with?

:confused: Not sure what is meant here. Right now it is just a static XML page with attached DTD and XSL.


What CSS styles the end result?

The styles are set by the XSL.

Hopefully I answered your questions correctly. I appologize if I seem a little ignorant. I am new to XML. I don't have a problem doing my homework but I can't seem to find anything on inserting a plain, static image into a simple XML document. Everything seems to be about creating Dynamic and/or Ajax slideshows and media presentations. If anyone knows of a good, basic XML tutorial that covers working with simple graphics and images I would be tremendously grateful and . . . I could quit bugging you all. :D

_Aerospace_Eng_
09-28-2006, 07:07 PM
http://www.w3schools.com/xml/
Have you tried putting your tags in lowercase? I do believe XML needs to be all lowercase.

Scriptbanger
09-28-2006, 07:30 PM
Changed it all to lowercase. Still the same output.

Maybe I am entirely on the wrong track. Let's try a different question.

I need to put a static image into an XML document. What's the simplest way to do that?

gsnedders
09-28-2006, 08:13 PM
http://www.w3schools.com/xml/
Have you tried putting your tags in lowercase? I do believe XML needs to be all lowercase.

No, it doesn't. The only case requirement is for the elements to be consistent in their case (including in XSLTs and DTDs if they exist).

Alex Vincent
09-28-2006, 10:47 PM
Scriptbanger, can you save the post-transformation results to a file and post the contents of that file here? I have a sneaking suspicion your IMAGE elements are being treated as vanilla XML, without any appropriate styling to tell the browser to render an actual image.

zcorpan
09-29-2006, 12:42 AM
<img xmlns="http://www.w3.org/1999/xhtml" src="foo.png" alt=""/>

Scriptbanger
09-29-2006, 02:55 AM
I tried zcorpan's code with the same results [no images].

Alex Vincent. I hope this is what you meant. I saved the output in a pdf format. As you can see, I can alter the text but images [and HTML] dont show.

Alex Vincent
09-29-2006, 06:45 PM
*sigh* No. Can you post a link to the sample XML file as it goes through transformation?