arrays - xsl iterate through list of alphabet -


I have to walk again through alphabetical es, and for each one, print the letter, and then some code I have already worked in my database to display all the items that begin with that letter. Currently, I am selecting to retrieve the first letter of all the item names that I display. However, all the letters need to be displayed, and then show 'no items to show' where there are no items. Therefore, I can not use my selection now, which returns the letters with the items.

How can I make each letter without any hard coding, and then call my template every time 26 times?

this change :

  & lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" xmlns: my = "my: my" & gt; & Lt; Xsl: output omit-xml-declaration = "yes" indent = "yes" /> & Lt; Xsl: key name = "kItemBy1stLetter" match = "item" usage = "substring (., 1,1)" /> & Lt; Xsl: select variable name = "vDoc" = "/" /> & Lt; Xsl: Select variable name = "vAlphabet" = "'ABCDEFGHIKLMNOPCRSTUVXX" /> & Lt; My: Message & gt; No items found. & Lt; / My: Message & gt; & Lt; Xsl: select variable name = "vMessage" = "document ('') / * / my: message" /> & Lt; Xsl: template match = "/" & gt; & Lt; Xsl: each selection = "(document ('') // node () | document ('') // @ * | document ('') // namespace: *) * [not (status ()) & gt; 26 )] "& Gt; & Lt; Xsl: variable name = "vcurLetter" = "substring ($ vAlphabet, position (), 1)" /> & Lt; Xsl: each selection = "$ vDoc" & gt; & Lt; Xsl: variable name = "vSearchResult" select = "key ('kitmb 1 1 letter', $ vcurLetter)" /> & Lt; Xsl: Select the value = "concat ('& amp; #xA;', $ vcurLetter, ': & amp; #xA;')" / & gt; & Lt; Xsl: copy-of select = "$ vSearchResult | $ vMessage [no ($ vSearchResult)] / text ()" /> & Lt; / XSL: for-each & gt; & Lt; XSL: Text & gt; & Amp; #xA; & Lt; / XSL: text & gt; & Lt; / XSL: for-each & gt; & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

When applicable to this XML document (playing the role of "database"):

  & lt; Database & gt; & Lt; Items & gt; Bicycles & lt; / Item & gt; & Lt; Items & gt; Computers & lt; / Item & gt; & Lt; Items & gt; Cars & lt; / Item & gt; & Lt; Items & gt; Forks & lt; / Item & gt; & Lt; Items & gt; Gellato & lt; / Item & gt; & Lt; Items & gt; Hypervehicles & lt; / Item & gt; & Lt; Items & gt; Ichtiosaurs & lt; / Item & gt; & Lt; Items & gt; Jobs & lt; / Item & gt; & Lt; Items & gt; Not & lt; / Item & gt; & Lt; Items & gt; Lens & lt; / Item & gt; & Lt; Items & gt; Miracle & lt; / Item & gt; & Lt; Items & gt; Notes & lt; / Item & gt; & Lt; / Database & gt;  

generates the desired result :

  A: No items found. B: & lt; Items & gt; Bicycles & lt; / Item & gt; C: & lt; Items & gt; Computers & lt; / Item & gt; & Lt; Items & gt; Cars & lt; / Item & gt; D: No items found E: No items found F: & lt; Items & gt; Forks & lt; / Item & gt; G: & lt; Items & gt; Goes & lt; / Item & gt; H: & lt; Items & gt; Hypervilles & lt; / Item & gt; I: & lt; Items & gt; Ichiosaur & lt; / Item & gt; J: & lt; Items & gt; Jobs & lt; / Item & gt; K: & lt; Items & gt; Knot & lt; / Item & gt; L: & lt; Items & gt; Lens & lt; / Item & gt; M: & lt; Items & gt; Miracle & lt; / Item & gt; N: & lt; Items & gt; Notes & lt; / Item & gt; O: No items found P: No items found Q: No items found R: No items found S: No items found T: No items found U: No items found. V: No items found W: No items found. X: No items found. Y: No items found Z: No items found.  

Comments