Hi, Stephane. "Stephane Dion" <[EMAIL PROTECTED]> wrote on 2005-10-20 02:51:26 PM: > Like you mention, I would like to have the same input XML as my > output XML (with the netPrice sorted) but the attributes are not > copied even if I have the xsl:copy. Can you help me on this?
The default value for the select attribute of the xsl:apply-templates instruction is "*", which means that templates matching the element children of the current node will be applied. So your stylesheet copies a node and then invokes apply templates for the child elements of that node, never doing the same for the attributes. The path expression for selecting all attributes of the context node is "@*". Your stylesheet will similarly need a template that matches any attribute node and copies it to the output document. > I tried to add my namespace but it?s not working anymore with it. The namespace prefix needs to be specified for each name to which it applies. Here's a modified stylesheet that should do what you expect: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aco="http://www.org/TRIP2004A/01" version="1.0"> <xsl:output method="xml"/> <xsl:template match="/aco:GetProductOptionsResponse/aco:DetailedProduct/aco:ProductOptionGroup/aco:ProductOption"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates> <xsl:sort data-type="number" select="@netAmount" order="ascending"/> </xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="*|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> See [1] for tutorial information about XSLT. You can find information about the Mulberry XSL Mailing List at [2], which is a good place to ask questions about XSLT. The xalan-j-users mailing list is really intended as a place to discuss issues that are specific to the Xalan-J processors. I hope that helps. Thanks, Henry [1] http://xml.apache.org/xalan-j/overview.html#uptospeed [2] http://xml.apache.org/xalan-j/faq.html#faq-N10025 ------------------------------------------------------------------ Henry Zongaro Xalan development IBM SWS Toronto Lab T/L 969-6044; Phone +1 905 413-6044 mailto:[EMAIL PROTECTED]
