Hello,
I want to do sorting in XSL using the attribute x and
y.
Example:
I have the following XML content.
<draw:text-box>
<draw:control svg:x="0.0937inch" svg:y="0.0626inch"
form:id="control2"/>
<draw:control svg:x="0.0937inch" svg:y="0.3437inch"
form:id="control3"/>
<draw:line svg:x1="0.1165inch" svg:y1="0.6118inch"
svg:x2="1.7622inch" svg:y2="0.6118inch"/>
<draw:control svg:x="0.0957inch" svg:y="0.6953inch"
form:id="control4"/>
<draw:line svg:x1="0.0752inch" svg:y1="1.122inch"
svg:x2="1.7417inch" svg:y2="1.122inch"/>
</draw:text-box>
In my XSL file, I am doing the sorting by the
following way.
<xsl:template name="draw:text-box">
<Box>
<xsl:for-each select="child::*">
<xsl:sort order="ascending"
select="number(substring-before(./@svg:y,'inch'))"/>
<xsl:sort order="ascending"
select="number(substring-before(./@svg:x,'inch'))"/>
<xsl:choose>
<xsl:when test="name()='draw:control'">
<xsl:call-template name="draw:control"/>
</xsl:when>
<xsl:when test="name()='draw:line'">
<xsl:call-template name="draw:line"/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</Box>
</xsl:template>
Question:
In the XML, for the "draw:line" node we don't have 'y'
and 'x' attributes. so, i got the problem to sort
this.
I want to get the following output. How to do sort for
x and x1, y and y1 ?
<box>
<control2>
<control3>
<line1>
<control4>
<line2>
</box>
Any ideas?
Thanks
Regards,
Arul
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
--~------------------------------------------------------------------
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>
--~--