[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Sorting XML data by <entry ID="">

Subject: Sorting XML data by <entry ID="">
From: "Charles Muller acmuller@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 5 Jan 2022 04:31:41 -0000
 Sorting XML data by <entry ID="">
My dictionary data has the below basic format (simplified here):

<entry ID="c8fc4">
  <pron>
  <sense>
  <refs>
</entry>
<entry ID="c8f00">
  <pron>
  <sense>
  <refs>
</entry>
<entry ID="c8f25">
  <pron>
  <sense>
  <refs>
</entry>

...which I want to sort by @ID.

The below XSLT seems to work, but despite the xsl:output method="xml" declaration, the files come out as .html (even though the contents are fine). What am I missing?


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="no"/>
<xsl:template match="dealt">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates select="entry">
<xsl:sort select="@ID" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>


<xsl:template match="@* | node()">
 <xsl:copy>
  <xsl:apply-templates select="@* | node()"/>
 </xsl:copy>
</xsl:template>


Regards,


Chuck



---------------------------
A. Charles Muller, Professor

Buddhist Culture Research Center
Musashino University
1-1-20 Shinmachi, Nishitokyo-shi
Tokyo 202-8585, Japan
Office Phone: 042-468-3145

(University of Tokyo, Professor Emeritus)
Web Site: Resources for East Asian Language and Thought
http://www.acmuller.net

Twitter: @ACharlesMuller

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.