homepage Welcome to WebmasterWorld Guest from 54.166.96.101
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

    
XLS (position of elements)
ebbo

5+ Year Member



 
Msg#: 3941091 posted 4:14 pm on Jun 26, 2009 (gmt 0)

Hello, Im pretty new to all this, in fact I ve been throw a peice of work to do and i dont know any XSL at all (thanks boss). My task is to update our styles on a website.

It looks fairly straight forward, but one thing i cant figure out is how the position of elements determined on screen. They seem to always go into fixed positions on the screen no matter where I place the code?

[code]
xsl:template match="COMPANY">
<hr/>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="COMPANY_NAME">
<p> <span class="coname"><xsl:apply-templates/></span>
<!--<span class="formerly"><xsl:value-of select="../FORMERLY"/></span>-->
</p>
</xsl:template>
<xsl:template match="DX_NO">
<p class="plain"><span class="title">DX No:</span><span class="idval"><xsl:apply-templates/></span></p>
</xsl:template>
<xsl:template match="EMAIL">
<p class="plain"><span class="title">Email:</span><span class="idval"><xsl:apply-templates/></span></p>
</xsl:template>
<xsl:template match="EVENT">
<p class="event"><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="FAX">
<p class="plain"><span class="title">Fax:</span><span class="idval"><xsl:apply-templates/></span></p>
</xsl:template>
<xsl:template match="lemma">code]

it looks like company_name then dx_no then email should be shown - in that order. I can swap and change the order of this code wherever I like but once the data still retains the same position once loaded into the browser. Is there a file that usually links to XSL files to help the screen arrangement?

 

jake792

5+ Year Member



 
Msg#: 3941091 posted 4:26 pm on Jul 3, 2009 (gmt 0)

<xsl:apply-templates/>

This command means "run through my XML and match as you find the nodes." In your case, the rendering will be in the order of appearance in the XML. If the DX_NO node appears before an EMAIL node, then it will show up in the HTML that way.

You need to invoke the templates directly:

<xsl:template match="/">
<xsl:call-template name="showdata"/>
</xsl:template>

<xsl:template name="showdata">
<p>
DX No:<xsl:value-of select="DX_NO"/>
</p>
<p>
e-Mail:<xsl:value-of select="EMAIL"/>
</p>
<p>
Facsimile:<xsl:value-of select="FAX"/>
</p>
<p>
Event:<xsl:value-of select="EVENT"/>
</p>
</xsl:template>

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved