XSLT: Add line breaks before preserve space elements

XrumBaseSaleA

New Member
This is my edited previous question for line breaks before the preserve space elements.Suppose my xml like this,\[code\]<content><titleGroup><title>text</title></titleGroup><creators1><creator><personName> <Name>john</Name></personName></creator></creators1><creators2><affiliation><orgDiv> text </orgDiv><address><country>UK</country></address></affiliation></creators2></content>\[/code\]i used the following xsl:\[code\]<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"><xsl:output method="xml" indent="yes"/><xsl:strip-space elements="*"/><xsl:preserve-space elements ="creators1 creators2"/><xsl:template match ="/"> <xsl:copy> <xsl:apply-templates select="@* | node()"/></xsl:copy> </xsl:template></xsl:stylesheet>\[/code\]output produced by this xml,\[code\]<content><titleGroup><title>text</title></titleGroup><creators1><creator><personName><Name>john</Name></personName></creator></creators1><creators2><affiliation><orgDiv>text</orgDiv><address><country>UK</country></address></affiliation></creators2></content>\[/code\]but i need line breaks before the element in the elements list of preserve space not after that element (a tag need to start and end into a single line) like this,\[code\] <content><titleGroup><title>text</title></titleGroup> <creators1><creator><personName><Name>john</Name></personName></creator></creators1><creators2><affiliation><orgDiv>text</orgDiv><address><country>UK</country></address></affiliation></creators2></content>\[/code\]i need to give a line break at the end of titlegroup and also at the end of creators1.pls don't suggest the answer like use \[code\]<xsl:text></xsl:text>\[/code\] i need to do this by using preserve space or some other ways.Thanks.
 
Back
Top