This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

complex sorting


Hi,

I am having trouble performing sorts (didn't seem like any of the archives
tackled this but I may have missed it) based on certain conditions.  The
logic should work like this:

This should parse the numeric value and sort, which it does fine, except
that all the attributes are stripped off the output.

<xsl:template match ="I1/@* |I1">
	<xsl:if test="I1/@i44='N'">
		<xsl:copy>
			<xsl:apply-templates select="@* | I1">
				<xsl:sort select="@i29" data-type="number" order="descending"/>
			</xsl:apply-templates>
		</xsl:copy>
</xsl:if>
</xsl:template>

I need to perform a different sort if test ='Y' for the same attribute node,
moving the entire record to another section of the document.  that would
look something like this.

	<xslt:template match="I1/@* |I1">
		<xslt:copy>
			<xslt:apply-templates select="I1|@*">
			<xslt:sort select="@i25" data-type="number" order="descending"/>
			</xslt:apply-templates>
		</xslt:copy>
	</xslt:template>

the same rules apply for other nodes as well as 'I1'.
so, the output should look something like this:

		<I1 Identity="5" i29="1140" i44="N"/>
		<I13 Id="38" i24="1" i25="20010426" i28="3" i31="Y" i48="N" i50="BC"
i29="Y" i30="Y"/>
		<I1 Identity="9" i29="1272" i44="Y"/>
		<I1 Identity="3" i29="1172" i44="Y"/>
		<I13 Id="5" i24="1" i25="20010426" i28="3" i31="Y" i48="Y" i50="BC"/>

I've been working on this problem for quite a while.  Does anyone have any
insight or examples of this type of thing?

Thanks and sorry so long,

Isaac
Developer
Info1Team


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]