This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XSLT element usage on textual outut
- To: xsl-list at mulberrytech dot com
- Subject: XSLT element usage on textual outut
- From: "Albert Tsun" <albert dot tsun at excel dot com dot hk>
- Date: Fri, 20 Oct 2000 13:57:23 +0800
- Reply-To: xsl-list at mulberrytech dot com
Hi all,
I am trying to produce a textual report from a XML data source and using
XSLT with Xalan.
I have some of the formatting problems when writing the XSL stylesheet,
please advise and help.
XML data source:
<Report>
<Header>
<Title> Sales Report </Title>
</Header>
<SalesRec>
<ID>0001</ID>
<Code>AC001</Code>
<Name>Product A</Name>
<Qty>10000</Qty>
<Cost>10000.00</Cost>
</SalesRec>
<SalesRec>
<ID>0002</ID>
<Code>BC001</Code>
<Name>Product B</Name>
<Qty>10000</Qty>
<Cost>10000.00</Cost>
</SalesRec>
<SalesRec>
<ID>0003</ID>
<Code>CC001</Code>
<Name>Product C</Name>
<Qty>10000</Qty>
<Cost>10000.00</Cost>
</SalesRec>
<Footer>**** End of Report ****</Footer>
</Report>
Expected Textual Output:
Sales Report ID: 0001
-----------------------------------------------------------------------
Code : AC001 Name : Product A
Qty : 10000
Cost : 100000.00
<page break>
Sales Report ID: 0002
-----------------------------------------------------------------------
Code : AC001 Name : Product B
Qty : 10000
Cost : 100000.00
<page break>
Sales Report ID: 0003
-----------------------------------------------------------------------
Code : CC001 Name : Product C
Qty : 10000
Cost : 100000.00
**** End of Report ****
XSL stylesheet:
<xsl:stylesheet>
<xsl:template match="/">
<xsl:apply-template select="*"/>
</xsl:template>
<xsl:tempate match="Header">
<!--- Q1. How to copy "title" text element in variable and can be
reused to "SalesRec" template,
please give sample code -->
.......
.......
</xsl:template>
<xsl:template match="SalesRec">
<!-- Q2. How to use stored "title" text in Header, please give
sample code-->
<!-- Q3. How to insert page break char -->
.......
.......
</xsl:template>
<xsl:template match="Footer">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Thanks in advance.
Albert Tsun
Excel Techology Int. (HK) Ltd
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list