Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. I need to be able to output the text of an XML document separated by line breaks
  2.  
  3. Need output following
  4. <ShortNote>
  5. <SNHeading1>Criminal Law</SNHeading1>
  6. <SNHeading2>Police</SNHeading2>
  7. <SNHeading3>#Appointment to Sensitive Posts</SNHeading3>
  8. <SNHeading4>Director General of Police (DGP)</SNHeading4>
  9. </ShortNote>
  10.  
  11. following code use but not output according to me:-
  12. <xsl:template match="ShortNote/CatchWord">
  13. <xsl:param name="text" select="normalize-space(.)"/>
  14. <xsl:if test="normalize-space(substring-before(concat($text,'&#8212;'),'&#8212;'))!=''">
  15. <xsl:element name="SNHeading{position()}">
  16. <xsl:value-of select="normalize-space(substring-before(concat($text,'&#8212;'),'&#8212;'))"/>
  17. </xsl:element>
  18. </xsl:if>
  19. <xsl:if test="contains($text,'&#8212;')">
  20. <xsl:message><xsl:value-of select="."/></xsl:message>
  21. <xsl:element name="SNHeading{position()+1}">
  22. <xsl:apply-templates select=".">
  23. <xsl:with-param name="text" select="substring-after($text,'&#8212;')"/>
  24. </xsl:apply-templates>
  25. </xsl:element>
  26. </xsl:if>
  27. </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement