Altova Mailing List Archives

Re: XSLT: XML to XML with schema validation on output XML

From: q_test <jluost1@-----.--->
Date: 9/21/2006 11:31:00 AM

I am using Oracle XSLT Parser 2.0.

Another note: We have Oracle form that tells the server where the XML 
file and XSL file are, then submit the form. The process will be kicked 
off on the server and invoking the XSLT parser and generate the output file.

The process or form can be changed if necessary. Thanks.

q_test wrote:
> I have an existing XML invoice file and want to transform it into a new 
> XML invoice file that conforms to an industry standard. The new XML file 
> must be validated by its industry standard schema(XSD file):
> xsi:schemaLocation=" 
> schemas/total/Invoice-2002-02-14-V1-0.xsd
> I can generate the output XML using XSL. Then I will drop the resulting 
> XML invoice file to a vendor's server. The vendor's server will then 
> validate my XML file using the schema XSL file. If there is an error, my 
> invoice will be rejected. To prevent this from happening, I want to 
> validate my output XML against the schema file before I send it to the 
> vendor.
> How can I do that? Can I do it within XSL file?
> Hope the following will be helpful. Thanks.
> Following is what the input XML like:
> -------------
> <?xml version="1.0" encoding="UTF-8"?>
> --------------
> Following is what the desired output XML is:
> -----------
> <?xml version="1.0" encoding="UTF-8"?>
> <pidx:Invoice xmlns:pidx="" 
> xmlns:xsi="" 
> xmlns="" 
> pidx:transactionPurposeIndicator="Original" pidx:version="1.0" 
> xsi:schemaLocation=" 
> schemas/total/Invoice-2002-02-14-V1-0.xsd">
>   <pidx:InvoiceProperties>
>     <pidx:InvoiceNumber>A001</pidx:InvoiceNumber>
>      ...
> ----------
> Following is the top of my XSL to generate the output:
> -------
> <?xml version='1.0' encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:pidx=""
> xmlns:xsi=""
> xmlns=""
> xmlns:xsl=""
>  >
> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
> <xsl:template match="INVOICES">
>     <xsl:apply-templates select="INVOICE"/>
>   </xsl:template>
> <xsl:template match="INVOICE">
>   <pidx:Invoice>
>   <xsl:attribute 
> name="pidx:transactionPurposeIndicator">Original</xsl:attribute>
>   <xsl:attribute name="pidx:version">1.0</xsl:attribute>
>   <xsl:attribute 
> name="xsi:schemaLocation"> 
> schemas/total/Invoice-2002-02-14-V1-0.xsd</xsl:attribute>
> </pidx:Invoice>
> ...
> </xsl:template>
> --------
> Thanks.


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.