[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Newbie XSL Question

Subject: Newbie XSL Question
From: "Glenn MacGregor" <gtm@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 18 Feb 2004 08:48:40 -0500
php replace
Hi All,

I have searched the newsgroup archives and not found anything relevant to my
question, so here goes...

I am writing a php report generation application that will take an xml file
as input, substitute some real variables for placeholders and create the
report. I was thinking of using xsl to help me with this task. Here is what
I have so far:

XML Config file:
<html>
<head><title>Test Title</title></head>
<body><table><tr><td colspan="2"><hsn:replace
with="tag">title</hsn:replace></td></tr>
<hsn:foreach param="devices">
<tr><td><hsn:var name="devices"/></td></tr>
</hsn:foreach>
</body>
</html>

So in the html (xml) I have tow tags <hsn:replace> and <hsn:foreach>.

The <hsn:replace> is used to replace the complete ("<hsn:replace
with="tag">title</hsn:replace>") tag with the CDATA of the tag defined in
the hsn:replace CDATA. So replace the complete hsn:replace tag with "Test
Title".

The <hsn:foreach> tag is used to iterate over a list of things(devices in
this case) and substitute the current one in the CDATA of the hsn:foreach
tag. So if there were 3 devices(test1,test2,test3) the output I would like
would be:

<tr><td>test1</td></tr>
<tr><td>test2</td></tr>
<tr><td>test3</td></tr>

for that section.

Do you think XSL could help me in any of these tasks? I assume I will have
my php scripts write some intermediate output (xml) in which the hsn:* tags
a changed to something more useful for XSL. Then run the intermediate file
through the XSL processor w/ a stylesheet to get the final output.

Is any of this possible?

    Thanks so much for your input!

            Glenn


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.