|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
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
|
|||
|
|||
|
XML in a real life situation
Hello!
I read the books, I read the tutorials, I read several devshed articles on this subject, but I still find it difficult to get the pieces togheter and figure out a real life use of XML. I have a website running with Mac OS 9.2, WebTen, FileMaker and Lasso, but in the future I will have Mac OS X, Apache, MySQL and PHP. In this site I have a section with +250 files of text. These files share the same structure (ie can share the very same DTD) and contain an extensive description of items (one file, one item). Let's say the files are like small books with same structure. Each file is more than 75 k of text and to spare bandwith I split them in 20 sections (ie chapters), serving the right one on user request (I use Lasso includes to do this). I also distribute these files to customers, but they don't want HMTL formatting, or better they want to use their HTML formatting. And they don't want split files. I managed to prepare a DTD a to make a XML version of a test file (which proved well formed and valid), but now I am stuck. What do I have to do to publish my XML file on my site? I think I should use XSL, but what wizardry do I have to use to get HTML out from XML and to publish just the only section the user requests to see? Thank you a lot for your time and help. |
|
#2
|
||||
|
||||
|
Yust a little example to set you on the way:
DATA.XML <?xml version="1.0"?> <?xml:stylesheet type="text/xsl" href="mailinglist.xsl"?> <xda> <field> <campo>name</campo> <campo>surname</campo> </field> <Data> <Record> <nome>john</nome> <cognome>smithi</cognome> </Record> </Data> </xda> DATA.XSL <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><xsl:template match="/"><HTML><BODY><TABLE BORDER="2"><TR STYLE="font-size:8pt; font-family:Verdana; color:white; text-decoration:underline"><TD STYLE="background-color urple">mail</TD></TR><xsl:for-each select="Data/Record"><TR STYLE="font-family:Verdana; font-size:8pt; color:black; padding:0px 6px"><TD><xsl:value-of select="mail"/></TD></TR></xsl:for-each></TABLE></BODY></HTML></xsl:template></xsl:stylesheet>Take a look at how it transforms the xml file. You can find good tutorials at www.ibm.com/developerworks Hope this helps!
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
Thank you for your help, but I tried and I could see just an empty square...
The real problem, however, is I dont' think relying on the user's browser to parse and 'convert' xml is a good solution. We are talking about a commercial site and I don't want to loose customer just because they don't have the most updated browser. I think I would think the same also for a 'non commercial' site. I was asking wether it is possible to convert XML to HTML on the server side (in real time or not) serving normal HTML to clients. Again, thanks a lot for your time. |
|
#4
|
|||
|
|||
|
I use PHP's XML parser to create HTML server-side from XML
It's great because PHP tags in XML don't have to output HTML, they can perform any PHP function whatsoever as well. Guess where I learnt to do it as well? Yes... PHP with XML on DevShed ![]() |
|
#5
|
||||
|
||||
|
Hi, I'm sorry but I made a mistake (XSL not made for this XML file, look at "value-of select="mail"/" where there is no "mail" in XML).
You can apply transformations srver side via Apache Cocoon, look for it at www.phpbuilder.com. Good luck! |
|
#6
|
|||
|
|||
|
I got one...
Well I was asked today to work with docushare I have to learn XML because this the language used in the template system. I also have to create my own pages using the database...That is one real life situation I have come by recently. SG
__________________
echo $lol; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XML in a real life situation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|