Hi everyone. I'm new to ultrashock, and I am unfamiliar to the environment, and I was hoping I could turn to some of the shockers with XML/XSL experience. I am running into quite a predicament with publishing some XML and trying to use global variables. I am trying to grab the name of the tag and pass it to other templates as a global (dynamically, since i'm trying to reuse my stylesheet for numerous XML files). for example in the code below, i am trying to create an HTML table with 'person' in the table heading, and then have the attributes contents follow in the table as well.
------------------------------------------------------------------------------------
XML code:
------------------------------------------------------------------------------------
<recordset>
<person>
<name>Stan</name>
<address>2000 Commonwealth Ave.</address>
<phone>6173276627</phone>
</person>
<person>
<name>Dany</name>
<address>360 Huntington Ave.</address>
<phone>6175846627</phone>
</person>
<person>
<name>Dennis</name>
<address>135 Beacon Street.</address>
<phone>6177108827</phone>
</person>
</recordset>
------------------------------------------------------------------------------------
XSL code:
------------------------------------------------------------------------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xslutput method="html" indent="yes" />
<!--Global variable declaration-->
<xsl:template match="recordset">
<table cellpading="1" border="2" width="100%">
<tr>
<td align="LEFT" valign="TOP" bgcolor="#ff9d9d"><b><font size="3" color="#000000" face="Times New Roman"><!--<xsl:value-of select="name(.)"/>--> Person (Other numerous Attributes) Information </font></b></td>
</tr>
</table>
<table cellpadding="1" width="100%" border="2" bgcolor="ffffff" summary="Valid Values">
<thead>
<tr>
<th bgcolor="#64b1ff"><FONT SIZE="2" FACE="Times New Roman" COLOR="#000000">name</FONT></th>
<th bgcolor="#64b1ff"><FONT SIZE="2" FACE="Times New Roman" COLOR="#000000">address</FONT></th>
<th bgcolor="#64b1ff"><FONT SIZE="2" FACE="Times New Roman" COLOR="#000000">phone</FONT></th>
</tr>
</thead>
<xsl:apply-templates select="person"/>
</table>
</xsl:template>
<xsl:template match="person">
<tr>
<xsl:for-each select="*">
<td><xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:template>
</xsl:stylesheet>
------------------------------------------------------------------------------------
Q: How can I actually define and pass a global (xml tag name = 'person') variable throughout the stylesheets from one template to another? Is this accomplishable at all in the context that it is in right now? Thanks in advance Shockers.
desired look:
person.html