Lainaus champion boliao <gsem980(_at_)yahoo(_dot_)com(_dot_)sg>:
| I have the following code in my xsl file.
|
| <row font-bold='true' alignment-horizontal='center'>
| <cell defined-name="month1">Jan</cell>
| <cell defined-name="month2">Feb</cell>
| <cell defined-name="month3">Mar</cell>
| <cell defined-name="month4">Q1</cell>
| <cell defined-name="month5>>Apr</cell>
| <cell defined-name="month6">May</cell>
| <cell defined-name="month7">Jun</cell>
| <cell defined-name="month8">Q2</cell>
| <cell defined-name="month9">Jul</cell>
| <cell defined-name="month10">Aug</cell>
| <cell defined-name="month11">Sep</cell>
| <cell defined-name="month12">Q3</cell>
| <cell defined-name="month13">Oct</cell>
| <cell defined-name="month14">Nov</cell>
| <cell defined-name="month15">Dec</cell>
| <cell defined-name="month16">Q4</cell>
| </row>
|
| I would like to do a for loop or whatever possible
| ways to auto-geneate the content. Something like
| below:
|
| <row font-bold='true' alignment-horizontal='center'>
| <cell define-name=getMonth()>getData()</cell>
| </row>
|
| I don't know whether it is possible and how should I
| code the getMonth() and getData() method. What should
| the syntax like?
|
| Please give me your insight and thank you very much.
|
| __________________________________________________
| Do You Yahoo!?
| Promote your business from just $5 a month!
| http://sg.biztools.yahoo.com
|
| XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
|
I am not quite sure if this is what you want to output (since your message is
not quite explicit, but what the heck).
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<xsl:for-each select="/row/cell">
<row font-bold="{../@font-bold}"
alignment-horizontal="{../@alignment-horizontal}">
<cell define-name="{(_at_)defined-name}">
<xsl:apply-templates/>
</cell>
</row>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<!-- EOF -->
The output would be:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<row font-bold="true" alignment-horizontal="center">
<cell define-name="month1">Jan</cell>
</row>
<row font-bold="true" alignment-horizontal="center">
<cell define-name="month2">Feb</cell>
</row>
<row font-bold="true" alignment-horizontal="center">
<cell define-name="month3">Mar</cell>
</row>
<row font-bold="true" alignment-horizontal="center">
<cell define-name="month4">Q1</cell>
</row>
........
I bet there is more generic / flexible ways to do this. Perhaps the real gurus
can help out with this.
Cheers,
Jarkko
***************************************************
* Jarkko Moilanen *
* Project Researcher, ITCM (www.itcm.org) *
* Profound XML technology Expert *
* University of Tampere *
* Hypermedia Laboratory *
***************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list