Subject: Where is apply-imports going wrong?
From: Ankit Jain <Ankit.Jain@xxxxxxxxxxx>
Date: Wed, 19 Mar 2003 13:32:08 +0100
|
Hello,
I am attaching 4 files (2 xml + 2 corresponding xsl files),.
I shall explain briefly :
I have two files Northwind.xml and its stylsheet NorthwindPO3.xsl.
>From the above specified XML file I create a new file temp.xml that
contains new elements "Annotation" that have certain attributes, for example "type".
Now I generate a stylesheet(temp.xsl) that imports the stylesheet
NorthwindPO3.xsl and apply this stylesheet to temp.xml
Now, my aim is to display the temp.xml with formattings from
NorthwindPO3.xsl + new formattings for all elements "ANNOTATION".
Means, I wish to override the formattings of NorthwindPO3.xsl with new
formattings as specified in temp.xsl file
But to my surprise, all the values disappear when i open the temp.xml
file using temp.xsl.
Could somebody please tell where i am going wrong in the creation of
temp.xsl
Thanks in advance,
Ankit
Northwind.xml ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="NorthwindPO3.xsl"?>
>
> <biztalk_1 xmlns="urn:biztalk-org:biztalk:biztalk_1">
> <header>
> <delivery>
> <message>
> <messageID>xyzzy:8</messageID>
> <sent>1999-01-02T19:00:01+02:00</sent>
> <subject>Purchase Order</subject>
> </message>
> <to>
> <address>http://www.fabrikam.com/recv.asp</address>
> <state>
> <referenceID/>
> <handle/>
> <process/>
> </state>
> </to>
> <from>
> <address>mailto:foo@xxxxxxxxxxx</address>
> <state>
> <referenceID>123</referenceID>
> <handle>7</handle>
> <process>myprocess</process>
> </state>
> </from>
> </delivery>
> <manifest>
> <document>
> <name>PO</name>
> <description>Purchase Order</description>
> </document>
> </manifest>
> </header>
> <body>
> <POHeader>
> <poNumber>12345</poNumber>
> <custID>100200300</custID>
> <description>Order for 200 desktop PCs
> </description>
> <paymentType>Invoice</paymentType>
> <shipType>Express2d</shipType>
> <Contact>
> <contactName>John Doe</contactName>
> <contactEmail>jdoe@xxxxxxxxxxxx</contactEmail>
> <contactPhone>4250001212</contactPhone>
> </Contact>
> <POShipTo>
> <attn>Fabrikam Receiving</attn>
> <street>10 Main Street</street>
> <city>Anytown</city>
> <stateProvince>WA</stateProvince>
> <postalCode>98000</postalCode>
> <country>USA</country>
> </POShipTo>
> <POBillTo>
> <attn>Fabrikam Payables</attn>
> <street>101 Headquarters Road</street>
> <city>Anytown</city>
> <stateProvince>WA</stateProvince>
> <postalCode>98000</postalCode>
> <country>USA</country>
> </POBillTo>
> </POHeader>
> <POLines>
> <Item>
> <line>1</line>
> <partno>pc1010</partno>
> <qty>200</qty>
> <uom>EACH</uom>
> <unitPrice>800.00</unitPrice>
> <discount>10</discount>
> <totalAmount>144000.00</totalAmount>
> </Item>
> <Item>
> <line>1</line>
> <partno>monitor17</partno>
> <qty>200</qty>
> <uom>EACH</uom>
> <unitPrice>300.00</unitPrice>
> <discount>20</discount>
> <totalAmount>48000.00</totalAmount>
> </Item>
> </POLines>
>
> </body>
> </biztalk_1>
>
>
NorthwindPO3.xsl ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> <xsl:template match="/">
> <html>
> <style TYPE="text/css">
> body {font-family:Arial;
> font-size:12pt; font-weight:normal;
> color:blue;
> line-height:55%}
> </style>
> <body>
> <p>
> <strong>Message ID: </strong>
> <xsl:value-of select="//messageID" /><br></br>
> <strong>Sent: </strong>
> <xsl:value-of select="//sent" /><br></br>
> <strong>Subject: </strong>
> <xsl:value-of select="//subject" /><br></br>
> <strong>To: </strong>
> <xsl:value-of select="//to/address" /><br></br>
> <strong>From: </strong>
> <xsl:value-of select="//from/address" /><br></br>
> <strong>PO Number: </strong>
> <xsl:value-of select="//body//poNumber" />
> <br></br>
> <strong>Customer ID: </strong>
> <xsl:value-of select="//body//custID" /><br></br>
> <strong>Description: </strong>
> <xsl:value-of select="//body//description" />
> <br></br>
> <strong>Contact: </strong>
> <xsl:value-of select="//body//contactName" />
> <br></br>
> <xsl:value-of select="//body//contactEmail" />
> <br></br>
> <xsl:value-of select="//body//contactPhone" />
> <br></br>
> <strong>POShipTo: </strong>
> <xsl:value-of select="//body//attn" /><br></br>
> <xsl:value-of select="//body//street" />
> <br></br>
> <xsl:value-of select="//body//city" />
> <xsl:value-of select="//body//stateProvince" />
> <xsl:value-of select="//body//postalCode" />
> <xsl:value-of select="//body//country" /><br></br>
> <strong>count: </strong>
> <xsl:value-of select="//body//count" /><br></br>
> <strong>Total Amount: </strong>
> <xsl:value-of select="//body//totalAmount" />
> <br></br>
> <strong>Item:<br></br>Line Number: </strong>
> <xsl:value-of select="//body//line" /><br></br>
> <strong>Part Quantity: </strong>
> <xsl:value-of select="//body//qty" /><br></br>
> <strong>Part Unit Of Measurement: </strong>
> <xsl:value-of select="//body//uom" /><br></br>
> <strong>Part Unit Price: </strong>
> <xsl:value-of select="//body//unitPrice" />
> <br></br>
> <strong>Part Discount: </strong>
> <xsl:value-of select="//body//discount" />
> <br></br>
> <strong>Part Total Amount: </strong>
> <xsl:value-of select="//body//totalAmount" />
> <br></br>
> </p>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
>
temp.xml ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <?xml-stylesheet type="text/xsl" href="temp.xsl"?>
> <biztalk_1 xmlns="urn:biztalk-org:biztalk:biztalk_1">
> <header>
> <delivery>
> <message>
> <Annotation title="GOODWORK" type="MINE" author="jain" comments="zegt" linkto=" ">
> <messageID xmlns="urn:biztalk-org:biztalk:biztalk_1">xyzzy:8</messageID>
> </Annotation>
> <sent>1999-01-02T19:00:01+02:00</sent>
> <subject>Purchase Order</subject>
> </message>
> <to>
> <address>http://www.fabrikam.com/recv.asp</address>
> <state>
> <referenceID/>
> <handle/>
> <process/>
> </state>
> </to>
> <from>
> <address>mailto:foo@xxxxxxxxxxx</address>
> <state>
> <referenceID>123</referenceID>
> <handle>7</handle>
> <process>myprocess</process>
> </state>
> </from>
> </delivery>
> <manifest>
> <document>
> <name>PO</name>
> <description>Purchase Order</description>
> </document>
> </manifest>
> </header>
> <body>
> <POHeader>
> <poNumber>12345</poNumber>
> <custID>100200300</custID>
> <Annotation title="ghk-123" type="interesting" author="jain" comments="h" linkto="">
> <description xmlns="urn:biztalk-org:biztalk:biztalk_1">Order for 200 desktop PCs
> </description>
> </Annotation>
> <paymentType>Invoice</paymentType>
> <shipType>Express2d</shipType>
> <Contact>
> <contactName>John Doe</contactName>
> <contactEmail>jdoe@xxxxxxxxxxxx</contactEmail>
> <contactPhone>4250001212</contactPhone>
> </Contact>
> <POShipTo>
> <attn>Fabrikam Receiving</attn>
> <street>10 Main Street</street>
> <city>Anytown</city>
> <stateProvince>WA</stateProvince>
> <postalCode>98000</postalCode>
> <country>USA</country>
> </POShipTo>
> <POBillTo>
> <attn>Fabrikam Payables</attn>
> <street>101 Headquarters Road</street>
> <city>Anytown</city>
> <stateProvince>WA</stateProvince>
> <postalCode>98000</postalCode>
> <country>USA</country>
> </POBillTo>
> </POHeader>
> <POLines>
> <Item>
> <line>1</line>
> <partno>pc1010</partno>
> <qty>200</qty>
> <uom>EACH</uom>
> <unitPrice>800.00</unitPrice>
> <discount>10</discount>
> <totalAmount>144000.00</totalAmount>
> </Item>
> <Item>
> <line>1</line>
> <partno>monitor17</partno>
> <qty>200</qty>
> <uom>EACH</uom>
> <unitPrice>300.00</unitPrice>
> <discount>20</discount>
> <totalAmount>48000.00</totalAmount>
> </Item>
> </POLines>
> </body>
> </biztalk_1>
>
>
temp.xsl ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xml:space="default">
> <xsl:import href="NorthwindPO3.xsl" />
>
> <xsl:template match="Annotation[@type = 'interesting']" >
> <DIV style="background:PINK">
> <xsl:apply-imports/>
> </DIV>
> </xsl:template>
>
> <xsl:template match="Annotation[@type = 'MINE']" >
> <DIV style="background:YELLOW">
> <xsl:apply-imports/>
> </DIV>
> </xsl:template>
>
> <xsl:template match="Annotation[@type = 'Whatsoever']" >
> <img src='C:\WINNT\Profiles\rabat\Bureau\Annotation\Data\balloon.bmp' /><xsl:apply-imports/>
> </xsl:template>
>
> <xsl:template match="Annotation[@type = 'important']" >
> <img src='C:\WINNT\Profiles\rabat\Bureau\Annotation\Data\DataStore.bmp' />
> <xsl:apply-imports/>
> </xsl:template>
>
> </xsl:stylesheet>
Thanks in advance.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|