XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 21st, 2004, 12:09 AM
Zero-x252 Zero-x252 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Colorado
Posts: 61 Zero-x252 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 22 sec
Reputation Power: 5
Send a message via AIM to Zero-x252 Send a message via MSN to Zero-x252 Send a message via Yahoo to Zero-x252
n00b having problems with the output display

having problems displaying this table correctly (after XSL/XML)
here is the original HTML (excluding addition of 1 HR, and an IMG tag...):
PHP Code:
<table width="476" border="0" cellpadding="0" cellspacing="0" summary="">
    <
tr>
        <
td width="20" height="20" style="width:20px;height:20px;background:url('lefttop.gif');background-repeat:no-repeat;"></td>
        <
td colspan="1" rowspan="4" width="120" valign="top" style="padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;">User-Image<br><br>User Information<br><br>Date</td>
        <
td colspan="1" width="4" rowspan="5" bgcolor="#808080"></td>
        <
td colspan="1" rowspan="2" height="20" width="311" valign="top" style="height:20px;padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;">Title</td>
        <
td width="20" height="20" style="width:20px;height:20px;background:url('righttop.gif');background-repeat:no-repeat;"> </td>
    </
tr>
    <
tr>
        <
td width="20" rowspan="3"  style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:left;"> </td>
        <
td width="20" rowspan="1" height="3" style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:right;"> </td>
    </
tr>
    <
tr>
        <
td width="312"  bgcolor="#808080" height="4" style="height:4px;"></td>
        <
td width="20" style="background: #808080" rowspan="1" height=""></td>
    </
tr>
    <
tr>
        <
td width="312" height="100" valign="top">message</td>
        <
td width="20" rowspan="1" style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:right;"> </td>
    </
tr>
    <
tr>
        <
td width="20" height="20" style="background: url('leftbottom.gif');width:20px;height:20px;background-repeat:no-repeat;"> </td>
        <
td height="20" style="background:url('border-horiz-repeat.gif') bottom;background-repeat:repeat-x;"></td>
        <
td height="20" style="background:url('border-horiz-repeat.gif') bottom;background-repeat:repeat-x;"></td>
        <
td width="20" height="20" style="background: url('rightbottom.gif');width:20px;height:20px;background-repeat:no-repeat;"> </td>
    </
tr>
</
table

here is the XSL:
PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
 <html>
 <head>
 <title>Grafitti Productions - Home</title>
 </head>
 <body>
<xsl:for-each select="posts/post">
<table width="476" border="0" cellpadding="0" cellspacing="0" summary="">
    <tr>
        <td width="20" height="20" style="width:20px;height:20px;background:url('lefttop.gif');background-repeat:no-repeat;"/>
        <td colspan="1" rowspan="4" width="120" valign="top" style="padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;"><img><xsl:attribute name="src"><xsl:value-of select="@imgpath"/></xsl:attribute><xsl:attribute name="alt"><xsl:value-of select="@user"/></xsl:attribute></img><br/><xsl:value-of select="@inf"/><hr/><xsl:value-of select="@date"/></td>
        <td colspan="1" width="4" rowspan="5" bgcolor="#808080"/>
        <td colspan="1" rowspan="2" height="20" width="311" valign="top" style="height:20px;padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;"><xsl:value-of select="@title"/> </td>
        <td width="20" height="20" style="width:20px;height:20px;background:url('righttop.gif');background-repeat:no-repeat;"> </td>
    </tr>
    <tr>
        <td width="20" rowspan="3"  style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:left;"/>
        <td width="20" rowspan="1" height="3" style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:right;"/>
    </tr>
    <tr>
        <td width="312"  bgcolor="#808080" height="4" style="height:4px;"/>
        <td width="20" style="background: #808080" rowspan="1" />
    </tr>
    <tr>
        <td width="312" height="100" valign="top"><xsl:value-of select="/"/></td>
        <td width="20" rowspan="1" style="background: url('border-vertical-repeat.gif');background-repeat:repeat-y;background-position:right;"/>
    </tr>
    <tr>
        <td width="20" height="20" style="background: url('leftbottom.gif');width:20px;height:20px;background-repeat:no-repeat;"/>
        <td height="20" style="background:url('border-horiz-repeat.gif') bottom;background-repeat:repeat-x;"/>
        <td height="20" style="background:url('border-horiz-repeat.gif') bottom;background-repeat:repeat-x;"/>
        <td width="20" height="20" style="background: url('rightbottom.gif');width:20px;height:20px;background-repeat:no-repeat;"/>
    </tr>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

and here is the XML (for demo only):
PHP Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml
-stylesheet type="text/xsl" href="test.xsl"?>
<posts>
<post title="stupid" inf="User Info" user="user" date="date" imgpath="user.gif">
Msg Body
</post>
</posts>

All help appreciated..

Reply With Quote
  #2  
Old August 23rd, 2004, 11:09 AM
rguilbault rguilbault is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 30 rguilbault User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 18 sec
Reputation Power: 5
um, what's the display problem? i.e. is there a row not rendering, or the images don't match up or something? what browser have you tried this in?

Reply With Quote
  #3  
Old August 25th, 2004, 10:07 PM
Phrenetical Phrenetical is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 156 Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 sec
Reputation Power: 9
Instead of using

<xsl:template match="/">

Which is lazy

try something like

<xsl:template match="posts">
...
...
<xsl:for-each select="post">

That will help you a little but as stated above i have no idea whats going wrong because you didnt specify.

ALSO, format your coding tags properly, its in rules if you read them, im talking about your huge line of the XSL display code, next time

Code:
<tr> 
        <td width="20" height="20" style="width:20px;height:20px;background:url('lefttop.gif');background-repeat:no-repeat;"/> 
        <td colspan="1" rowspan="4" width="120" valign="top" style="padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;">
		<img>
		<xsl:attribute name="src">
			<xsl:value-of select="@imgpath"/>
		</xsl:attribute>
		<xsl:attribute name="alt">
			<xsl:value-of select="@user"/>
		</xsl:attribute>
		</img><br/>
		<xsl:value-of select="@inf"/><hr/>
		<xsl:value-of select="@date"/></td> 
        <td colspan="1" width="4" rowspan="5" bgcolor="#808080"/> 
        <td colspan="1" rowspan="2" height="20" width="311" valign="top" style="height:20px;padding-top:2px;background:url('border-horiz-repeat.gif');background-repeat:repeat-x;background-position:top;">
		<xsl:value-of select="@title"/></td> 
        <td width="20" height="20" style="width:20px;height:20px;background:url('righttop.gif');background-repeat:no-repeat;"> </td> 
    </tr> 


Would be better, thats just a rough indentation of your code, learn to use proper style syntax, it will save your *** in the future.

Also i dont think your supposed to use <img> in the XSL try something like this to diplay your image

Code:
<xsl:element name="img">
			<xsl:attribute name="src">
  				<xsl:value-of select="PICTURE" /> 
  			</xsl:attribute>
			<xsl:attribute name="width">
  				<xsl:value-of select="80" /> 
  			</xsl:attribute>
			<xsl:attribute name="height">
  				<xsl:value-of select="80" /> 
  			</xsl:attribute>
			<xsl:attribute name="border">
				<xsl:value-of select="0"/>
			</xsl:attribute>
  		</xsl:element>


Reply With Quote
  #4  
Old August 26th, 2004, 04:33 AM
IvanE IvanE is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 98 IvanE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 19 m 38 sec
Reputation Power: 5
The <img> tag will actually work, at least it does for me. You just have to make sure the tag is closed. Usually I just copy it straight from the html in and close the tag.

Currently I am using <xsl:attribute> as well but only because the attributes are in the xml.

But whether using the <img> tag in xsl is 'proper xsl', well that's another question I suppose but I haven't come across anywhere against this kind of programming....yet!

Reply With Quote
  #5  
Old August 26th, 2004, 07:29 PM
Phrenetical Phrenetical is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 156 Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 sec
Reputation Power: 9
Im assuming the <img> wont work in strict xml, probably only transitional and loose doctypes will allow it, i havnt tested this, but i cant imagine that <img> counts as proper xsl.

Reply With Quote
  #6  
Old August 27th, 2004, 04:40 AM
IvanE IvanE is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 98 IvanE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 19 m 38 sec
Reputation Power: 5
Its just his code is similar to what I use, same declarations on top etc so if that is followed it should work. I suppose it is something worth asking though, should html code be broken up to be more of an xsl format like that way you have mentioned or should it be left as it is when its inside a html tag. Most other things are being forced into strict html before being accepted so surely if it is strict html within a html tag and its not using any values in the xml, is it not right?

On a side issue I did notice that the first line is

<?xml version="1.0" encoding="ISO-8859-1"?>

and as mentioned on a previous post by me, I found that I still got an encoding of utf8. Might be something to watch out for and if it does happen use <xsl: output encoding> to set the encoding either instead of that line or as well as.

Reply With Quote
  #7  
Old August 27th, 2004, 10:38 PM
Zero-x252 Zero-x252 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Colorado
Posts: 61 Zero-x252 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 22 sec
Reputation Power: 5
Send a message via AIM to Zero-x252 Send a message via MSN to Zero-x252 Send a message via Yahoo to Zero-x252
thank you, you're imput did solve my problem
the main problem was that a whole section of the tabe (row, column, whatever) wasn't rendering correctly, creating a white-space in the border
using posts instead of / helped a bit
it solved a problem that could also be solved by adding <msg></msg> inside each post, and using the xsl:value-of select="msg"/> inside the post area of the table...
All is well and working now..
just a few more things to do and get good at before the new layout is completely finished
thanks again
~Zero

Reply With Quote
  #8  
Old August 29th, 2004, 07:06 PM
Phrenetical Phrenetical is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 156 Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level)Phrenetical User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 5 sec
Reputation Power: 9
Glad i helped Zero, gl with your xml journey.

IvanE, yeah im not saying one is right over the other, its just the way i learnt to do it, which i consider to be something that will be more scalable in the future, as xsl progresses.

Also i didnt quite understand what you ment by

"I found that I still got an encoding of utf8. Might be something to watch out for and if it does happen use <xsl: output encoding> to set the encoding either instead of that line or as well as."

My problem is as a very very busy web designer i have pre built micro templates for my xsl, just the bare bone skeleton, and as i develop i add more to the xsl to cover my xml and so'on. So if my encoding thing is wrong, can you please give me either the code i should be using, or point me to a web site that explains what i should be doing.

Reply With Quote
  #9  
Old August 30th, 2004, 04:39 AM
IvanE IvanE is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 98 IvanE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 19 m 38 sec
Reputation Power: 5
Phrenetical, I tend to do the same in terms of putting together one file and reusing it then for everything making the necessary changes where needed. Its just when different requirements come up, you tend to question things you haven't questioned before.

Please don't assume that I am right in what I am saying and that you are doing things wrong in any way. Its just that I noticed one of two things that may be worth noting or may be things that I am using wrongly.

What I was talking about, was that in the first post by zero there is the following line,

<?xml version="1.0" encoding="ISO-8859-1"?>

Currently some of the xsl pages I am using output different encodings. The default is 'utf8'. Previously I just used the default as it suited me but now I needed to output different ones. What I noticed is that by using the line above on its own, I kept getting 'utf8' no matter what the encoding was set to.

However if I added the following line

<xslutput encoding="iso8859-1"/>

and either left the first line or took it out completely, then I got the required encoding. It may mean nothing to you, but it may be worth having a look at your output encoding to see if its what you specified. Remember 'utf8' is the default and will always come up so try something else.

Because you didn't have this line in your post it may not be an issue at all for you and remember it could be some sort of error I've managed to get myself....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > n00b having problems with the output display


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |