Sample XSLT stylesheet

The following XSLT stylesheet forces a relationship between orders and addresses by computing all combinations. The output document conforms to the required DTD.

Note: If you use an XSLT stylesheet that generates an XML document that does not conform to the required DTD, XML Input may produce unusable rows or no rows at all.

<?xml version="1.0" ?> 
<xsl:stylesheet xmlns:xsl="" version="1.0">
   <xsl:output method="xml" indent="yes" /> 
   <xsl:template match="/">
         <xsl:apply-templates select="/customers/customer/orders/order" /> 
   <xsl:template match="order">
      <xsl:variable name="id" select="../../@id" /> 
      <xsl:apply-templates select="/customers/customer/addresses/address[../../@id =$id]">
         <xsl:with-param name="id" select="$id" /> 
         <xsl:with-param name="order_no" select="@order_no" /> 
   <xsl:template match="address">
      <xsl:param name="id" /> 
      <xsl:param name="order_no" /> 
         <column name="CUSTOMER_ID">
            <xsl:value-of select="$id" /> 
         <column name="ORDER_NO">
            <xsl:value-of select="$order_no" /> 
         <column name="STREET">
            <xsl:value-of select="@street" /> 
         <column name="CITY">
            <xsl:value-of select="@city" /> 
         <column name="STATE">
            <xsl:value-of select="@state" /> 
         <column name="ZIP">
            <xsl:value-of select="@zip" />