procesy5_config.folders.xsl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <procesy5_config>
  10. <xsl:apply-templates/>
  11. </procesy5_config>
  12. </xsl:template>
  13. <xsl:template match="procesy5_config.folders.server">
  14. <xsl:variable name="procesy5_config.folders.server">
  15. <xsl:apply-templates/>
  16. </xsl:variable>
  17. <!--<xsl:copy-of select="$procesy5_config.folders.server"></xsl:copy-of>-->
  18. <xsl:apply-templates select="$procesy5_config.folders.server" mode="from_tokenize"/>
  19. </xsl:template>
  20. <xsl:template match="*"/>
  21. <xsl:template match="text()">
  22. <xsl:for-each select="tokenize(.,'\[')">
  23. <lev1><xsl:attribute name="pos" select="position()"/>
  24. <xsl:for-each select="tokenize(.,'\]')">
  25. <lev2><xsl:attribute name="pos" select="position()"/>
  26. <xsl:for-each select="tokenize(.,'\n')">
  27. <levbr><xsl:attribute name="pos" select="position()"/>
  28. <xsl:for-each select=" tokenize(.,'=')">
  29. <lev3><xsl:attribute name="pos" select="position()"/>
  30. <xsl:value-of select="."/>
  31. </lev3>
  32. </xsl:for-each>
  33. </levbr>
  34. </xsl:for-each>
  35. </lev2>
  36. </xsl:for-each>
  37. </lev1>
  38. </xsl:for-each>
  39. </xsl:template>
  40. <xsl:template mode="from_tokenize" match="lev1[@pos='1']"/>
  41. <xsl:template mode="from_tokenize" match="lev1">
  42. <xsl:element name="{lev2[@pos='1']/levbr[@pos='1']/lev3[@pos='1']/text()}">
  43. <xsl:for-each select="lev2[ number(@pos) &gt; 1]">
  44. <xsl:for-each select="levbr[number(@pos) &gt;1]">
  45. <xsl:for-each select="lev3">
  46. <xsl:if test="@pos div 2 mod 1 and not(contains(.,';'))">
  47. <xsl:element name="{text()}">
  48. <xsl:value-of select=" replace( normalize-space(../lev3[@pos= number(current()/@pos)+1]),'[&quot;;]','')"/>
  49. </xsl:element>
  50. </xsl:if>
  51. </xsl:for-each>
  52. </xsl:for-each>
  53. </xsl:for-each>
  54. </xsl:element>
  55. </xsl:template>
  56. </xsl:stylesheet>