Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] centralised alphabetical order ...

From: "james walker" <jameswalkerandy@----------->
To:
Date: 4/1/2004 12:33:00 AM
Hello,

I think i am quite close to solving my problem but i am trying to create a 
key which groups titles with the same starting letter togather. This is the 
xsl:

------------------

-------------------



<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xx="urn:schemas-microsoft-com:xslt" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
exclude-result-prefixes="xx">

<xsl:output method="html" omit-xml-declaration="yes" />



<xsl:variable name="index">
<Best_Practices>http://....data.xml</Best_Practices>
<Business_and_Technical_Education>http://....data3.xml</Business_and_Technical_Education>
</xsl:variable>

<xsl:variable name="nsindex" select="xx:node-set($index)"/>



<!--Create a key to catgeorise titles by first letter-->

<xsl:key name="cat-by-firstocc" match="document($nsindex/)//link" 
use="substring(title,1,1)" />



<xsl:template match="/">
<xsl:for-each select="document($nsindex/*)/root/link">
<xsl:value-of select="title" />
</xsl:for-each>
</xsl:template>

------------------------
------------------------

The xml structure of both files (bestpractice and busniess and technical 
education) are exactly the same, they look like this:



--------------------------
----------------------------

<root>
<link><title></title><url></url></link>
<link><title></title><url></url></link>
<link><title></title><url></url></link>
</root>

----------------------
------------------------

Xtrans seems to complain about not allowing a variable "$nsindex" in the 
match statement for the key tag. How do i create a key to group all files in 
nsindex by first letter of the titles?



Also, i have never created an xsl which only uses imported files before. 
What do i perform the translation against, an empty xml file?



cheers



_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent