XSl gurus pls help

wxdqz

New Member
Hi,I dynamically create an XML from data whic i get from variant arrays. Theformat of the XML is same as created by an ADO persistent recordsetI dont know the field names and also the number of fields in the XML.I want to create a HTML page which displays the field names and the data.The rs:name attribute of s:AttributeType tag gets me the actual field namewhile the name attribute gets me the abbreviated name which is used in thez:row tag for data.I want to get the value of the name attribute and the correspondingattribute value from z:row tag.My problem is I am not able to get the syntax right to pass the value ofname attribute and get the corresponding z:row valueAny help is appreciated. Also any good sites and books for XSL?The following is the XSL file code<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><xsl:template match="/"><HTML><TITLE>Demo</TITLE><LINK href=http://forums.devx.com/archive/index.php/"Styles/DSStyle.css" rel="stylesheet" type="text/css"><base target="bottom"></base></LINK><BODY align="left"><FORM action="results.asp" id="form1" method="post" name="form1"><TABLE background="" border="0" cellPadding="1" cellSpacing="5"width="84%"><TR style="TEXT-ALIGN: right"><TD><INPUT id="submit1" name="submit1" style="BORDER-BOTTOM-COLOR: white;BORDER-BOTTOM-WIDTH: 1px;BORDER-LEFT-COLOR: white; BORDER-LEFT-WIDTH: 1px; BORDER-RIGHT-COLOR: white;BORDER-RIGHT-WIDTH: 1px; BORDER-TOP-COLOR:white; BORDER-TOP-WIDTH: 1px; HEIGHT: 24px; WIDTH: 140px" type="submit"value="Calculate Results >>"></INPUT></TD></TR></TABLE><TABLE border="1" cellPadding="1" cellSpacing="1" class="Inputs"id="Inputs" width="80%"><COLGROUP><COL></COL><COL></COL></COLGROUP><COLGROUP bgColor="lightgreen"><COL></COL></COLGROUP><TR align="middle" borderColorDark="#fcfcfc" borderColorLight="#cccccc"style="HEIGHT: 27px"><TH><FONT class="TableFont">Group Name</FONT></TH><TH><FONT class="TableFont">Field Name</FONT></TH><TH><FONT class="TableFont">Value</FONT></TH></TR><xsl:apply-templates select="xml/s:Schema/s:ElementType/s:AttributeType"/></TABLE></FORM></BODY></HTML></xsl:template><xsl:template name="getfield"><xsl:param name="fieldname">c0</xsl:param><xsl:value-of select="{concat('xml/rs:data/z:row/@',$fieldname)}"/></xsl:template><xsl:template match="xml/s:Schema/s:ElementType/s:AttributeType"><TR><TD><xsl:value-of select="@GroupName"/></TD><TD><xsl:value-of select="@rs:name"/></TD><TD><xsl:call-template name="getfield"><xsl:with-param name="fieldname">@name</xsl:with-param></xsl:call-template></TD></TR><xsl:apply-templates/></xsl:template><xsl:template name="getfield"><xsl:param name="fieldname"/><xsl:value-of select="{concat('xml/rs:data/z:row/@',$fieldname)}"/></xsl:template></xsl:stylesheet>
 
Back
Top