Here's a simple example I pulled from the link:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<abstract>Hello there!
This is just a test</abstract>
<?xml version="1.0" encoding="UTF-8"?>
<abstract>Hello there!
This is just a test</abstract>
To copy to clipboard, switch view to plain text mode
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:template match="/">
<html>
<body>
<xsl:analyze-string select="abstract" regex="\n">
<xsl:matching-substring>
<br/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:template match="/">
<html>
<body>
<xsl:analyze-string select="abstract" regex="\n">
<xsl:matching-substring>
<br/>
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="."/>
</xsl:non-matching-substring>
</xsl:analyze-string>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
To copy to clipboard, switch view to plain text mode
Output from Qt4 app:
<html>
<body/>
</html>
<html>
<body/>
</html>
To copy to clipboard, switch view to plain text mode
Output from Altova XMLSpy:
<html>
<body>Hello there!<br>This is just a test</body>
</html>
<html>
<body>Hello there!<br>This is just a test</body>
</html>
To copy to clipboard, switch view to plain text mode
My version of qt is 4.7.0 (32-bit) Windows version downloaded from qt.nokia.com/products . I didn't compile the source myself. And if its relevent, I am running Windows 7 Home 64-bit.
Bookmarks