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]

xsl array alternatives (novice)


Hi,

Please forgive my intrusion O xsl gurus...

I'm working getting a set of nodes to output in a different group and am
having trouble with it.
I have xml that looks something like this:

Exhibit A. --before
(many other irrelevent records)...
<nodeA att1="True" att2="N" att3="1234"/>
<nodeA att1="True" att2="N" att3="321"/>
<nodeA att1="True" att2="N" att3="456"/>
<nodeA att1="True" att2="Y" att3="9876"/>
<nodeB att1="True" att5="Y" att3="45"/>
<nodeB att1="True" att5="N" att3="65"/>
<nodeC att1="True" att7="Y" att3="784"/>
<nodeC att1="True" att7="Y" att3="412"/>
<nodeC att1="True" att7="N" att3="635"/>
...(many other irrelevent records)

I would like to create xml output that looks something like this:

Exhibit B. --after
(many irrelevent records)...
<nodeA att1="True" att2="N" att3="1234"/>
<nodeA att1="True" att2="N" att3="321"/>
<nodeA att1="True" att2="N" att3="456"/>
<nodeB att1="True" att5="N" att3="65"/>
<nodeC att1="True" att7="N" att3="635"/>
...(many irrelevent records that may or may not have duplicate attribute
names and values)
<nodeA att1="True" att2="Y" att3="9876"/>
<nodeB att1="True" att5="Y" att3="45"/>
<nodeC att1="True" att7="Y" att3="784"/>
<nodeC att1="True" att7="Y" att3="412"/>
<end of document/>

In other words, based on the specified attribute node being 'Y', move the
nodes to the bottom of the document and sort them accordingly (sorts already
in place)

My first instinct is to store the outlaw records with the attribute value
being 'Y' into arrays and reprinting them as I like.  However, I found that
arrays are not supported in xsl, but I'm sure there's a way to hack around
this.  I await your wisdom...

ps I also thought this could work:   in a for-each, do
<xsl:variable name="nvalue" select="."/>  but am quite stuck.


 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]