Hi,
Sorry. My input xml which believe you are referring to as
period.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<dynamicpage>
<val>Roman</val>
<val>Islamic</val>
<val>byzantine</val>
</dynamicpage>
which is the same as what you gave me.
And the xml 'xamp2.xml' where I store the timeperiods in order is as
follows:
<Timeperiods>
<entry period="middlebronze">1</entry>
<entry period="byzantine">2</entry>
<entry period="Roman">3</entry>
<entry period="Islamic">4</entry>
</Timeperiods>
I hope things will be clearer now.
cheers,
prakash
srinivas vemuri
<s_vas98(_at_)yahoo(_dot_)c To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
om> cc: (bcc:
omprakash.v/Polaris)
Subject: Re: [xsl] custom xsl
sorting
09/08/2005 10:37
AM
Please respond
to xsl-list
Hi,
I am not very familiar with XSLT. I tried to reproduce
the same & it didn't work(w/o much understanding).
My Basic assumption is that:
Key 'tp' should be built on 'period.xml'. Here i have
the core part of the code:
<xsl:key name="tp" match="val" use="."/>
<xsl:variable name="tps"
select="document('xamp2.xml')/Timeperiods"/>
Inside template match /dynamicpage
<xsl:for-each select="$tps/*">
<xsl:sort select="."/>
<xsl:variable name="outp"
select="key('tp', @period)"/>
<xsl:value-of select="$outp"/>
</xsl:for-each>
What does sort do here? Sorts tps values!! or Sorts
/val values?? Neither makes sense to me.
Please correct me!!!
Thanks for your inputs & valuable time.
Srinivas.
--- omprakash(_dot_)v(_at_)polaris(_dot_)co(_dot_)in wrote:
Hi,
The following stylesheet should do what you
want.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"></xsl:output>
<xsl:key name="tp" match="val" use="."/>
<xsl:variable name="tps"
select="document('xamp2.xml')/Timeperiods"/>
<xsl:template match="/dynamicpage">
<xsl:for-each select="$tps/*">
<xsl:sort select="."/>
<xsl:variable name="outp"
select="key('tp', @period)"/>
<xsl:value-of select="$outp"/>
<xsl:if test="not(position() = last())
and $outp">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
cheers,
prakash
srinivas vemuri
<s_vas98(_at_)yahoo(_dot_)c To:
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
om> cc:
(bcc: omprakash.v/Polaris)
Subject: [xsl] custom xsl sorting
09/08/2005 08:31
AM
Please respond
to xsl-list
Hi,
I have to perform xsl sorting based on time period
instead of regular ascii or integer based sorting.
For
ex: According to ascii, BYZANTINE comes before
MIDDLE
BRONZE. But, according to this sort(time period):
MIDDLE BRONZE comes before BYZANTINE.
My initial idea is like this. A separate xml:
'period.xml' has this period to ascii mapping.
<entry period="middlebronze">1</entry>
<entry period="byzantine">2</entry>
<entry period="Roman">3</entry>
<entry period="islamic">4</entry>
......
----------------------------------------
Now, my stylesheet should be applied to a dynamic
xml
page & should order period values occur in that
page.
<dynamicpage>
<val>Roman</val>
<val>Islamic</val>
<val> byzantine </val>
</dynamicpage>
desired output after xslt application:
byzantine, Roman, Islamic
Please help regarding how xslt should look like?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
This e-Mail may contain proprietary and confidential
information and is sent for the intended
recipient(s) only.
If by an addressing or transmission error this mail
has been misdirected to you, you are requested to
delete this mail immediately.
You are also hereby notified that any use, any form
of reproduction, dissemination, copying, disclosure,
modification,
distribution and/or publication of this e-mail
message, contents or its attachment other than by
its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
This e-Mail may contain proprietary and confidential information and is sent
for the intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to
you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction,
dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--