[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Sorting network addresses
Subject: Re: [xsl] Sorting network addresses From: Craig W <codecraig@xxxxxxxxx> Date: Wed, 2 Mar 2005 09:54:56 -0500 |
How can add the DTD into my XSLT? Before the part that goes <networks> <xsl:value-of select="$newline" /> ... I want to add the DTD for the XML that will be generated (so that the generated XML has its DTD).. I want something like.. <!DOCTYPE networks [ <!ELEMENT ......> .... ]> <networks> <xsl:value-of select="$newline" /> but i am not sure how to get the DTD in there....the above gives errors. thanks On Wed, 2 Mar 2005 14:47:07 -0000, Michael Kay <mike@xxxxxxxxxxxx> wrote: > Saxon allows you to define a collation based on your own Java comparator > class. > > However, a better solution I think would be to write a function that > normalizes the value into something that collates naturally: in 2.0 you can > then invoke this function to calculate the sort key. > > xsl:sort select="my:mangler(ip-address)" > > xsl:function name="my:mangler" > xsl:param... > xsl:for-each select="tokenize(...)" > xsl:value-of select="format-number(...)" > > > Michael Kay > http://www.saxonica.com/ > > > -----Original Message----- > > From: Craig W [mailto:codecraig@xxxxxxxxx] > > Sent: 02 March 2005 12:51 > > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > > Subject: [xsl] Sorting network addresses > > > > Hi, > > Is there a way to extend the sort function provided by XSLT? I am > > using XALAN. Basically, the elements that I need to sort need a more > > specific sort than just text or number. > > > > well the default sorts are on number or text. But say I want to sort > > on network addresses, such as 1.2.3.4 ....text and number dont work > > here, I need my own sorting (like i would do with a Comparator in > > java).. > > > > so if i had > > > > 1.2.3.4 > > 170.1.3.3 > > 2.4.3.2 > > > > I would want the sort to be like > > 1.2.3.4 > > 2.4.3.2 > > 170.1.3.3 > > > > ...however (number sort wont work) and text sort does > > 1.2.3.4 > > 170.1.3.3 > > 2.4.3.2 > > > > see what i mean? > > > > A sample XML may be like > > ... > > <networks> > > <network> > > <address>1.2.3.4</address> > > </network> > > <network> > > <address>170.1.3.3</address> > > </network> > > <network> > > <address>2.4.3.2</address> > > </network> > > </networks> > > > > ....after sort i would like... > > > > <networks> > > <network> > > <address>1.2.3.4</address> > > </network> > > <network> > > <address>2.4.3.2</address> > > </network> > > <network> > > <address>170.1.3.3</address> > > </network> > > </networks> > > > > > > Someone suggested a key, but I am not sure how that works or how to > > make it sort on a network address. Any ideas? > > > > Thanks, > > Craig > > -- http://www.codecraig.com http://jroller.com/page/codecraig
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Sorting network addresses, Michael Kay | Thread | Re: [xsl] Sorting network addresses, David Carlisle |
RE: [xsl] Sorting network addresses, Michael Kay | Date | Re: [xsl] Sorting network addresses, David Carlisle |
Month |
Keywords