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 January 19th, 2004, 07:29 PM
gmillerd gmillerd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 gmillerd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
template creation aid

i would like to generate some html using xsl/xml transformation. using a xml source like this:

PHP Code:
<page>
    <
stuff>...</stuff>
    <
tbl type="big">...</tbl>
    <
somestuff>...</somestuff>
    <
tbl type="wide">...</tbl>
    <
area>
        <
tbl type="huge">...</tbl>
    </
area>
    <
morestuff>...</morestuff>
</
page



then use a template that will handle the non-'tbl' tags internally/manually and then have a reusable template that will transform the 'tbl' tags.

it seems that the XML needs to be walked through (by xpath?) or processed twice (XML->XML). though i am sure there is some syntax to make a template crawl the heirarchy that i am unaware of. i am using the 'g ken holman definateive xslt and xpath' as my source and its a little heady.

its to not clear to me how this might be done. can anyone help point me to a reference for doing something like this?

thanks

Reply With Quote
  #2  
Old January 19th, 2004, 08:50 PM
gmillerd gmillerd is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 4 gmillerd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i found that this works to a degree, i am not sure how to make it co exist with he classic ...

<xsl:template match="/">

... to render the rest of my document


PHP Code:
<xsl:stylesheet>
   <
xsl:template match="*/box">
        <
table>
            <
xsl:for-each select="//rows">
                <
tr>
                    <
xsl:for-each select="cell">
                        <
td><xsl:value-of select="."/></td>
                    </
xsl:for-each>
                </
tr>
            </
xsl:for-each>
        </
table>
        <
hr/>
    </
xsl:template>
</
xsl:stylesheet>

<
root>
    <
titlebar>
        <
item></item>
        <
box type="1">
            <
rows>
                <
cell>1</cell><cell>2</cell>
            </
rows>
            <
rows>
                <
cell>3</cell><cell>4</cell>
            </
rows>
        </
box>
        <
item></item>
    </
titlebar>
    <
box type="2">
        <
rows>
            <
cell>5</cell><cell>6</cell>
        </
rows>
        <
rows>
            <
cell>7</cell><cell>8</cell>
        </
rows>
    </
box>
</
root

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > template creation aid


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT