|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
I have this simple XML file:
<?xml version="1.0" encoding="UTF-8"?> <employees> <employee eid="p98145" dept="programming"> Gino </employee> <employee eid="grunt" dept="programming"> Mino </employee> <employee eid="t00022" dept="training"> Tino </employee> </employees> and this simple XSL to transform it: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Email Listing</title> <link rel="stylesheet" href="table.css" type="text/css" /> </head> <body> <table cellpadding="5" border="1"> <xsl:for-each select="employees/employee"> <tr><td>zzz <xsl:value-of select="employees/employee" /></td></tr> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> When I get the result in my browser with my PHP XSLT processor I get two table rows and not the three I expect to get. Does anybody know why? Thank you all for attention. |
|
#2
|
||||
|
||||
|
The code looks fine to me, dont know what is going on there. I just tried it on PHP 4.3 and it worked fine!
![]() |
|
#3
|
||||
|
||||
|
I got the bug, thank you.
|
|
#4
|
||||
|
||||
|
What was the problem in the end? Its helpful if the solution is posted that way when someone searches they can find an answer if they had a similar problem.
|
|
#5
|
||||
|
||||
|
I just loaded the wrong XML file in PHP code.
It has two <employee> tags instead of the one I submitted and intended to use. The bug was in my head! ![]() That's the reason why I didn't explain it to you all! Thank you again, bye. |
|
#6
|
||||
|
||||
|
LOL... i hope no-one else has that problem
I can understand how you felt when you realised that. I had a situation about a week ago where I had the wrong variables in a function, took me 2 hours to figure it out ![]() |
|
#7
|
|||
|
|||
|
Ever heard of validating you XML?
__________________
-- ngibsonau |
|
#8
|
||||
|
||||
|
Uhm.... I don't think it's the matter....
My XML doc is valid even if it contains 2 <employee> rather than 3... it could have 0 <employee> or 1456! So the wrong XML doc would have result a valid doc too! So, just to answer your question, yes, I've heard about XML validation, DTD and XML Schemas... Bye |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSLT doubt |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|