procesy5_config.folders.xsl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  4. exclude-result-prefixes="xs"
  5. version="2.0">
  6. <xsl:output indent="yes"/>
  7. <xsl:strip-space elements="*"/>
  8. <xsl:template match="procesy5_config">
  9. <xsl:apply-templates/>
  10. </xsl:template>
  11. <xsl:template match="procesy5_config.folders.server">
  12. <xsl:variable name="procesy5_config.folders.server">
  13. <xsl:apply-templates/>
  14. </xsl:variable>
  15. <!--<xsl:copy-of select="$procesy5_config.folders.server"></xsl:copy-of>-->
  16. <xsl:apply-templates select="$procesy5_config.folders.server" mode="from_tokenize"/>
  17. </xsl:template>
  18. <xsl:template match="*"/>
  19. <xsl:template match="text()">
  20. <xsl:for-each select="tokenize(.,'\[')">
  21. <lev1><xsl:attribute name="pos" select="position()"/>
  22. <xsl:for-each select="tokenize(.,'\]')">
  23. <lev2><xsl:attribute name="pos" select="position()"/>
  24. <xsl:for-each select="tokenize(.,'\n')">
  25. <levbr><xsl:attribute name="pos" select="position()"/>
  26. <xsl:for-each select=" tokenize(.,'=')">
  27. <lev3><xsl:attribute name="pos" select="position()"/>
  28. <xsl:value-of select="."/>
  29. </lev3>
  30. </xsl:for-each>
  31. </levbr>
  32. </xsl:for-each>
  33. </lev2>
  34. </xsl:for-each>
  35. </lev1>
  36. </xsl:for-each>
  37. </xsl:template>
  38. <xsl:template mode="from_tokenize" match="lev1[@pos='1']"/>
  39. <xsl:template mode="from_tokenize" match="lev1">
  40. <xsl:element name="{lev2[@pos='1']/levbr[@pos='1']/lev3[@pos='1']/text()}">
  41. <xsl:for-each select="lev2[ number(@pos) &gt; 1]">
  42. <xsl:for-each select="levbr[number(@pos) &gt;1]">
  43. <xsl:for-each select="lev3">
  44. <xsl:if test="@pos div 2 mod 1 and not(contains(.,';'))">
  45. <xsl:element name="{text()}">
  46. <xsl:value-of select=" replace( normalize-space(../lev3[@pos= number(current()/@pos)+1]),'[&quot;;]','')"/>
  47. </xsl:element>
  48. </xsl:if>
  49. </xsl:for-each>
  50. </xsl:for-each>
  51. </xsl:for-each>
  52. </xsl:element>
  53. </xsl:template>
  54. </xsl:stylesheet>