Welcome to WebmasterWorld Guest from 54.227.72.69

Forum Moderators: httpwebwitch

Message Too Old, No Replies

XLS (position of elements)

     
4:14 pm on Jun 26, 2009 (gmt 0)

New User

5+ Year Member

joined:June 26, 2009
posts:3
votes: 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?

4:26 pm on July 3, 2009 (gmt 0)

New User

5+ Year Member

joined:July 3, 2009
posts:1
votes: 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>

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members