Subject: Re: [xsl] schema reference in output From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 20 Apr 2009 10:17:32 +0100 |
Namespace declarations are not attributes in Xpath. In this case the simplest change to your code is to remove <xsl:attribute name="xmlns:xsi"><xsl:value-of select ="'http://www.w3.org/2001/XMLSchema-instance'"/> which is causing the error. Add xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" to your styleshet then when the processor sees <xsl:attribute name="xmlns:xsi" It will know which namespace is meant by xsi: and a namespace node will be added automatically. actually I wouldn't use xsl:attribute at all <xsl:element name="Employees"> <!-- schema verwijzingsattributen in main --> <!-- THIS IS WHERE IM HAVING TROUBLE --> <xsl:attribute name="xmlns:xsi"><xsl:value-of select ="'http://www.w3.org/2001/XMLSchema-instance'"/></xsl:attribute> <xsl:attribute name="xsi:noNamespaceSchemaLocation"><xsl:value-of select ="'400_o_emp.xsd'"/></xsl:attribute> could be more easily written <Employees xsi:noNamespaceSchemaLocation="400_o_emp.xsd"> <xsl:element name="Employee"> <xsl:attribute name="employeeNumber"> <xsl:value-of select="EMPLOYEENUMBER"/> </xsl:attribute> <xsl:attribute name="lastName"> <xsl:value-of select="LASTNAME"/> </xsl:attribute> <xsl:attribute name="Initials"> <xsl:value-of select="INITIALS"/> </xsl:attribute> <xsl:attribute name="firstName"> <xsl:value-of select="FIRSTNAME"/> </xsl:attribute> <xsl:attribute name="gender"> <xsl:value-of select="GENDER"/> </xsl:attribute> <xsl:attribute name="dateOfBirth"> <xsl:if test="DATEOFBIRTH"> <xsl:if test="DATEOFBIRTH!=''"> <xsl:call-template name="FormatDate"> <xsl:with-param name="DateTime" select="DATEOFBIRTH" /> </xsl:call-template> </xsl:if> </xsl:if> </xsl:attribute> </xsl:element> </xsl:for-each> </xsl:element> could more easily be written <Employee employeeNumber="{EMPLOYEENUMBER}" lastName="{LASTNAME}" Initials="{INITIALS}" firstName="{FIRSTNAME}" gender="{GENDER}" > <xsl:attribute name="dateOfBirth"> <xsl:if test="not(DATEOFBIRTH='')"> <xsl:call-template name="FormatDate"> <xsl:with-param name="DateTime" select="DATEOFBIRTH" /> </xsl:call-template> </xsl:if> </xsl:attribute> </Employee> David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] schema reference in outpu, Michael Kay | Thread | [xsl] XML to CSV columns problem, Byomokesh Sahoo |
RE: [xsl] schema reference in outpu, Michael Kay | Date | [xsl] XML to CSV columns problem, Byomokesh Sahoo |
Month |