Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT: Add line breaks before preserve space elements
    primarykey
    data
    text
    <p>This is my edited previous question for line breaks before the preserve space elements.</p> <p>Suppose my xml like this,</p> <pre><code>&lt;content&gt; &lt;titleGroup&gt; &lt;title&gt;text&lt;/title&gt; &lt;/titleGroup&gt; &lt;creators1&gt; &lt;creator&gt; &lt;personName&gt; &lt;Name&gt;john&lt;/Name&gt; &lt;/personName&gt; &lt;/creator&gt; &lt;/creators1&gt; &lt;creators2&gt; &lt;affiliation&gt; &lt;orgDiv&gt; text &lt;/orgDiv&gt; &lt;address&gt; &lt;country&gt;UK&lt;/country&gt; &lt;/address&gt; &lt;/affiliation&gt; &lt;/creators2&gt; &lt;/content&gt; </code></pre> <p>i used the following xsl:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;xsl:output method="xml" indent="yes"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;xsl:preserve-space elements ="creators1 creators2"/&gt; &lt;xsl:template match ="/"&gt; &lt;xsl:copy&gt; &lt;xsl:apply-templates select="@* | node()"/&gt; &lt;/xsl:copy&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>output produced by this xml,</p> <pre><code>&lt;content&gt;&lt;titleGroup&gt;&lt;title&gt;text&lt;/title&gt;&lt;/titleGroup&gt;&lt;creators1&gt; &lt;creator&gt;&lt;personName&gt;&lt;Name&gt;john&lt;/Name&gt;&lt;/personName&gt;&lt;/creator&gt;&lt;/creators1&gt;&lt;creators2&gt; &lt;affiliation&gt;&lt;orgDiv&gt;text&lt;/orgDiv&gt;&lt;address&gt;&lt;country&gt;UK&lt;/country&gt;&lt;/address&gt;&lt;/affiliation&gt;&lt;/creators2&gt;&lt;/content&gt; </code></pre> <p>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,</p> <pre><code> &lt;content&gt;&lt;titleGroup&gt;&lt;title&gt;text&lt;/title&gt;&lt;/titleGroup&gt; &lt;creators1&gt;&lt;creator&gt;&lt;personName&gt;&lt;Name&gt;john&lt;/Name&gt;&lt;/personName&gt;&lt;/creator&gt;&lt;/creators1&gt; &lt;creators2&gt;&lt;affiliation&gt;&lt;orgDiv&gt;text&lt;/orgDiv&gt;&lt;address&gt;&lt;country&gt;UK&lt;/country&gt;&lt;/address&gt;&lt;/affiliation&gt;&lt;/creators2&gt;&lt;/content&gt; </code></pre> <p><strong>i need to give a line break at the end of titlegroup and also at the end of creators1.</strong></p> <p>pls don't suggest the answer like use <code>&lt;xsl:text&gt;&lt;/xsl:text&gt;</code> i need to do this by using preserve space or some other ways.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload