[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Newbee
Hello
I am very new to XML and XSL. I am using .NET2003 for Xslt tranformation to create a text file. My Xml looks like this. <InvoiceFile xmlns="http://tempuri.org/InvoiceFile.xsd"> <Invoice> <CustomerCode>1234567</CustomerCode> <Item> <ItemNumber>10000</ItemNumber> <Description>Item one </Description> <Quantity>4</Quantity> <UnitPrice>100</UnitPrice> <Amount>500</Amount> </Item> <Item> <ItemNumber>20000</ItemNumber> <Description>Item two </Description> <Quantity>3</Quantity> <UnitPrice>200</UnitPrice> <Amount>900</Amount> </Item> <RowSummary> <Rows>2</Rows> <TotalRowAmount>1400</TotalRowAmount> </RowSummary> <Summary> <TotalAmount>1400</TotalAmount> <Currency>SEK</Currency> </Summary> </Invoice> <Total> <TotalInvoices>1</TotalInvoices> <TotalAmount>1400</TotalAmount> </Total> </InvoiceFile> And my xslt is <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="delimiter">';'</xsl:variable> <xsl:template match="/"> <xsl:text>10';'STARTINVOICEFILE';'</xsl:text> <xsl:apply-templates select="/InvoiceFile/Invoice"/> <xsl:text>99';'ENDINVOICEFILE';'</xsl:text> </xsl:template>
My output looks like 10';'STARTCUSTOMERFILE';'99';'ENDCUSTOMERFILE';' Where is all other information. And if I change root template to <xsl:template match="InvoiceFile"> <xsl:text>10';'STARTCUSTOMERFILE';'</xsl:text> <xsl:apply-templates select="Invoice"/> <xsl:text>99';'ENDCUSTOMERFILE';'</xsl:text> </xsl:template> I get(Text of all nodes in one line) 123456710000Item one 410050020000Item two 3200900214001234,9SEK11400 Whereas I expect only Customer code to be printed like 10';'STARTCUSTOMERFILE'1234567;'99';'ENDCUSTOMERFILE';' Please help. I know I am doing something wrong in the basics. Cannot figur out. Thanks in advance. P.S. my InvoiceFile.xsd has LOT more elements then they appear in XML
|
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
|