I'm not convinced that there is anything wrong per se, but after performing my transformation, I'm finding that the namespace is being included in each of my result elements. If I eliminate the xmlns:xsi and the xsi:schemaLocation from the source file, I get the expected result xmlfile, but I don't believe the original source can be validated. I'm asking this here since I'm using xalan-j. I'm not sure if this is an Xalan-j, XSL, or XMLSchema question.
I've included a test case below: SOURCE XMLFILE ============== <?xml version="1.0" encoding="ISO-8859-1"?> <order:form xmlns="http://www.w3.org/1999/xhtml" xmlns:order="http://www.paraware.com/order" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.paraware.com/order order.xsd"> <b>Ordered By</b> <br/> <order:author/> <br/> <order:subject/> <br/> <order:sendTo values="[EMAIL PROTECTED]" userDefined="false"/> <br/> <order:timestamp/> <br/> </order:form> OBTAINED RESULT XMLFILE ======================= <?xml version="1.0" encoding="UTF-8"?> <div xmlns="http://www.w3.org/1999/xhtml" xmlns:order="http://www.paraware.com/order" xmlns:xhtml="http://www.w3.org/1999/xhtml"><form> <b xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">Ordered By</b> <br xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> Author:unassigned <br xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> Subject: <input name="subject" type="text"/> <br xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> To: [EMAIL PROTECTED] <br xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> Created: unassigned <br xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> </form></div> EXPECTED RESULT XMLFILE ======================= <?xml version="1.0" encoding="UTF-8"?> <div xmlns:order="http://www.paraware.com/order" xmlns:xhtml="http://www.w3.org/1999/xhtml"><form> <b>Ordered By</b> <br/> Author:unassigned <br/> Subject: <input name="subject" type="text"/> <br/> To: [EMAIL PROTECTED] <br/> Created: unassigned <br/> </form></div> XSLFILE ======= <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:order="http://www.paraware.com/order" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xsl:output method="xml" encoding="UTF-8" indent="yes"/> <xsl:param name="user1">unassigned</xsl:param> <xsl:param name="current_time">unassigned</xsl:param> <xsl:template match="order:form"> <div> <form> <xsl:text/> <xsl:apply-templates/> </form> </div> </xsl:template> <xsl:template match="order:author"> Author:<xsl:value-of select="$user1"/> <xsl:text/> </xsl:template> <xsl:template match="order:sendTo"> <xsl:if test="@userDefined = 'true'"> <xsl:if test="string-length(normalize-space(@values)) = '0'"> To:<input type="text" name="sendTo"/> <xsl:text/> </xsl:if> <xsl:if test="string-length(normalize-space(@values)) > '0'"> <xsl:if test="starts-with(substring(normalize-space(@values), string-length(normalize-space(@values))), ',')"> To: <xsl:value-of select="@values"/> <input type="text" name="sendTo"/> <xsl:text/> </xsl:if> <xsl:if test="not(starts-with(substring(normalize-space(@values), string-length(normalize-space(@values))), ','))"> To: <xsl:value-of select="@values"/>, <input type="text" name="sendTo"/> <xsl:text/> </xsl:if> </xsl:if> </xsl:if> <xsl:if test="@userDefined = 'false'"> To: <xsl:value-of select="@values"/> <xsl:text/> </xsl:if> </xsl:template> <xsl:template match="order:subject"> Subject: <input type="text" name="subject"/> <xsl:text/> </xsl:template> <xsl:template match="order:timestamp"> Created: <xsl:value-of select="$current_time"/> <xsl:text/> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Thanks, - Brian
