xsl:param must be the first element within a template
Posted: Tue Sep 11, 2007 10:39 pm
I keep getting an error from Oxygen with the subject line above. When I look in my reference books on how to use xsl:call-templates I should be able to do the following:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ODVAcip="http://www.odva.org/schemas/ODVAcip.xsd"
version="1.0"
xml:space="preserve">
<xsl:output method="html" indent="yes" xml:space="preserve"/>
<!-- HTML layout with template call to various parsings -->
<xsl:template match="/">
<html>
<body>
<center><h1>EtherNet/IP Device Communication Report</h1></center>
<!-- <xsl:apply-templates select="//ODVAcip:ethernet_ip_device_communication_report" mode="Match_ALL" xml:space="preserve"/>-->
<xsl:call-template name="CommReport">
<xsl:with-param name="DevicePath" select="//ODVAcip:ethernet_ip_device_communication_report/device_information"/>
<xsl:with-param name="ConnectPath" select="//ODVAcip:ethernet_ip_device_communication_report/connections"/>
<xsl:with-param name="TimeConfigPath" select="//ODVAcip:ethernet_ip_device_communication_report/initialization_time_configurations"/>
<xsl:with-param name="NetworkPath" select="//ODVAcip:ethernet_ip_device_communication_report/network_services"/>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="CommReport">
<xsl:param name="DevicePath"/>
<xsl:param name="ConnectPath"/>
<xsl:param name="TimeConfigPath"/>
<xsl:param name="NetworkPath"/>
<xsl:for-each select="$DevicePath">
<u><h2>General</h2></u>
<h3>Device Information </h3> <br/>
<b>Manufacturer</b> <u><xsl:value-of select="./ODVAcip:manufacturer"/> </u><br/>
<b>Device Name</b> <u><xsl:value-of select="./ODVAcip:product_name"/> </u><br/>
<b>Model Number</b> <u><xsl:value-of select="./ODVAcip:serial_number"/> </u><br/>
<b>Short Description</b> <u><xsl:value-of select="./ODVAcip:product_name"/> </u><br/>
<b>Firmware Version</b> <u><xsl:value-of select="./ODVAcip:major_revision"/> </u><br/>
</xsl:for-each>
....etc
Oxygen keeps complaining about xsl:param must be the first element within a template and it calls out the 4 parameter names within my template. I don't know what I am doing wrong with respect to the reference book.
Thanks,
Freemon
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ODVAcip="http://www.odva.org/schemas/ODVAcip.xsd"
version="1.0"
xml:space="preserve">
<xsl:output method="html" indent="yes" xml:space="preserve"/>
<!-- HTML layout with template call to various parsings -->
<xsl:template match="/">
<html>
<body>
<center><h1>EtherNet/IP Device Communication Report</h1></center>
<!-- <xsl:apply-templates select="//ODVAcip:ethernet_ip_device_communication_report" mode="Match_ALL" xml:space="preserve"/>-->
<xsl:call-template name="CommReport">
<xsl:with-param name="DevicePath" select="//ODVAcip:ethernet_ip_device_communication_report/device_information"/>
<xsl:with-param name="ConnectPath" select="//ODVAcip:ethernet_ip_device_communication_report/connections"/>
<xsl:with-param name="TimeConfigPath" select="//ODVAcip:ethernet_ip_device_communication_report/initialization_time_configurations"/>
<xsl:with-param name="NetworkPath" select="//ODVAcip:ethernet_ip_device_communication_report/network_services"/>
</xsl:call-template>
</body>
</html>
</xsl:template>
<xsl:template name="CommReport">
<xsl:param name="DevicePath"/>
<xsl:param name="ConnectPath"/>
<xsl:param name="TimeConfigPath"/>
<xsl:param name="NetworkPath"/>
<xsl:for-each select="$DevicePath">
<u><h2>General</h2></u>
<h3>Device Information </h3> <br/>
<b>Manufacturer</b> <u><xsl:value-of select="./ODVAcip:manufacturer"/> </u><br/>
<b>Device Name</b> <u><xsl:value-of select="./ODVAcip:product_name"/> </u><br/>
<b>Model Number</b> <u><xsl:value-of select="./ODVAcip:serial_number"/> </u><br/>
<b>Short Description</b> <u><xsl:value-of select="./ODVAcip:product_name"/> </u><br/>
<b>Firmware Version</b> <u><xsl:value-of select="./ODVAcip:major_revision"/> </u><br/>
</xsl:for-each>
....etc
Oxygen keeps complaining about xsl:param must be the first element within a template and it calls out the 4 parameter names within my template. I don't know what I am doing wrong with respect to the reference book.
Thanks,
Freemon