[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: exclude-result-prefixes issue
> Please disregard my last question. I have managed to make it a little > further. My problem now is my output looks like The way I normally generate XHTML is to declare all the important namespaces in the xsl:stylesheet, and then just let processor handle setting the namespaces in the top element. I don't use <xsl:element> if I can get away with it. Both SAXON and Xalan seem to handle this in a nice way (and it's, to my eyes, easier to read): <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" xmlns:MCF-ENV="http://www.MCFmarket.com/soap/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:param name="senderid"/> <xsl:param name="receiverid"/> <xsl:param name="dateTime"/> <xsl:param name="documentid"/> <xsl:template match="Order"> <SOAP-ENV:Envelope> <SOAP-ENV:Header> <MCF-ENV:MCFSOAPHeader> <MCF-ENV:MCFSenderID> <xsl:value-of select="$senderid"/> </MCF-ENV:MCFSenderID> <MCF-ENV:MCFReceiverID> <xsl:value-of select="$receiverid"/> </MCF-ENV:MCFReceiverID> <MCF-ENV:transactionTimestamp> <xsl:value-of select="$dateTime"/> </MCF-ENV:transactionTimestamp> <MCF-ENV:logicalIdentifier> <xsl:text>NA</xsl:text> </MCF-ENV:logicalIdentifier> <MCF-ENV:businessDocIDs> <xsl:value-of select="$documentid"/> </MCF-ENV:businessDocIDs> <MCF-ENV:messageState> <xsl:text>Inbound</xsl:text> </MCF-ENV:messageState> </MCF-ENV:MCFSOAPHeader> </SOAP-ENV:Header> <SOAP-ENV:Body> <MCF-ENV:MCFSOAPBody> <MCF-ENV:businessDocID> <xsl:value-of select="$documentid"/> </MCF-ENV:businessDocID> <MCF-ENV:MCFMessageType> <xsl:text>MCFPurchaseOrder</xsl:text> </MCF-ENV:MCFMessageType> <MCF-ENV:messageFormat> <xsl:text>xCBL</xsl:text> </MCF-ENV:messageFormat> <MCF-ENV:messageContainer> <xsl:text>Order</xsl:text> </MCF-ENV:messageContainer> <MCF-ENV:businessDoc> <Order> <xsl:apply-templates select="OrderHeader"/> <xsl:call-template name="OrderDetail"/> <xsl:call-template name="OrderSummary"/> </Order> </MCF-ENV:businessDoc> </MCF-ENV:MCFSOAPBody> </SOAP-ENV:Body> </SOAP-ENV:Envelope> </xsl:template> <xsl:template name="OrderDetail"/> <xsl:template name="OrderSummary"/> </xsl:stylesheet> Using both SAXON and Xalan, I believe the above dumps out the elements and attributes you seem to want: <?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" xmlns:MCF-ENV="http://www.MCFmarket.com/soap/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <SOAP-ENV:Header> <MCF-ENV:MCFSOAPHeader> <MCF-ENV:MCFSenderID>sender1</MCF-ENV:MCFSenderID> <MCF-ENV:MCFReceiverID/> <MCF-ENV:transactionTimestamp>now baby, now</MCF-ENV:transactionTimestamp> <MCF-ENV:logicalIdentifier>NA</MCF-ENV:logicalIdentifier> <MCF-ENV:businessDocIDs>doc1.0</MCF-ENV:businessDocIDs> <MCF-ENV:messageState>Inbound</MCF-ENV:messageState> </MCF-ENV:MCFSOAPHeader> </SOAP-ENV:Header> <SOAP-ENV:Body> <MCF-ENV:MCFSOAPBody> <MCF-ENV:businessDocID>doc1.0</MCF-ENV:businessDocID> <MCF-ENV:MCFMessageType>MCFPurchaseOrder</MCF-ENV:MCFMessageType> <MCF-ENV:messageFormat>xCBL</MCF-ENV:messageFormat> <MCF-ENV:messageContainer>Order</MCF-ENV:messageContainer> <MCF-ENV:businessDoc> <Order/> </MCF-ENV:businessDoc> </MCF-ENV:MCFSOAPBody> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|