This is my edited previous question for line breaks before the preserve space elements.
Suppose my xml like this,
<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>
i used the following xsl:
<?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>
output produced by this xml,
<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>
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,
<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>
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 <xsl:text></xsl:text> i need to do this by using preserve space or some other ways.
Thanks.
Obviously it depends a lot on how you are processing it but with MSXSL 3 (which I assumed you were using from your namespaces), removing the output mode, getting rid of the preserve space and putting the text in the space
gives you:
and something similar in Xalan and Saxon