Created
November 1, 2012 22:31
-
-
Save aschweer/3997137 to your computer and use it in GitHub Desktop.
DSpace XMLUI render newlines in abstract metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="xsl xhtml"> | |
<!-- make sure double linefeeds are rendered as paragraph breaks --> | |
<xsl:template name="break"> | |
<xsl:param name="text" select="."/> | |
<xsl:choose> | |
<xsl:when test="contains($text, '

')"> | |
<p> | |
<xsl:call-template name="breaklines"> | |
<xsl:with-param name="text" select="substring-before($text, '

')"/> | |
</xsl:call-template> | |
</p> | |
<xsl:call-template name="break"> | |
<xsl:with-param name="text" select="substring-after($text, '

')"/> | |
</xsl:call-template> | |
</xsl:when> | |
<xsl:otherwise> | |
<p> | |
<xsl:call-template name="breaklines"> | |
<xsl:with-param name="text" select="$text"/> | |
</xsl:call-template> | |
</p> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
<!-- make sure single linefeeds are rendered as line breaks --> | |
<xsl:template name="breaklines"> | |
<xsl:param name="text" select="."/> | |
<xsl:choose> | |
<xsl:when test="contains($text, '
')"> | |
<xsl:value-of select="substring-before($text, '
')"/> | |
<br/> | |
<xsl:call-template name="breaklines"> | |
<xsl:with-param name="text" select="substring-after($text, '
')"/> | |
</xsl:call-template> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:value-of select="$text"/> | |
</xsl:otherwise> | |
</xsl:choose> | |
</xsl:template> | |
</xsl:stylesheet> |
Dear Andrea,
Could you please tell me where the location copy file "linebreaks.xsl"?
And now, I have two files "item-view.xsl". which file do I have to edit after adding the file "linebreaks.xsl"?
- D:\dspace\webapps\xmlui\themes\dri2xhtml-alt\aspect\artifactbrowser
- D:\dspace\webapps\xmlui\themes\Mirage\lib\xsl\aspect\artifactbrowser
Thank you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include this from your theme's main XSL file. Then in item-view.xsl, make sure to call
rather than just
when outputting the value of the metadata field (for those metadata fields where you want to show linebreaks, eg dc.description.abstract)