Advertisement
Guest User

Untitled

a guest
Jan 6th, 2014
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.29 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:transform version="1.0"
  3.  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. >
  5.  
  6. <!-- merge sibling elements, maybe separated with blankspace nodes -->
  7.  
  8. <xsl:template match="*">
  9.   <xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>
  10. </xsl:template>
  11.  
  12. <xsl:template match="text()[not( normalize-space() )]" mode="greek"/>
  13.  
  14. <xsl:template match="text()[not( normalize-space() )][ following-sibling::node()[self::spoj] ]" mode="greek">
  15.   <xsl:text> </xsl:text>
  16. </xsl:template>
  17.  
  18. <xsl:template match="spoj" mode="greek">
  19.   <xsl:apply-templates/>
  20. </xsl:template>
  21.  
  22. <xsl:template match="defpozn">
  23.   <comment><xsl:copy-of select="@*"/>
  24.     <xsl:copy-of select="node()[1][self::text()]"/>
  25.     <xsl:if test="spoj">
  26.     <expression>
  27.       <xsl:apply-templates select=" spoj[1] | spoj[1]/following-sibling::node()" mode="greek"/>
  28.     </expression>
  29.     </xsl:if>
  30.   </comment>
  31. </xsl:template>
  32.  
  33. <xsl:template match="defpozn[ *[ not(self::spoj)] ] | defpozn[ spoj[1]/following-sibling::text()[ normalize-space() ] ] ">
  34.   <xsl:message terminate="yes">
  35.     <xsl:text>Not supported:</xsl:text>
  36.     <xsl:copy-of select="."/>
  37.   </xsl:message>
  38. </xsl:template>
  39.  
  40.  
  41. <xsl:output
  42.  encoding="UTF-8"
  43.  indent="yes"
  44.  method="xml"
  45. />
  46.  
  47. </xsl:transform>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement