Adding line break to abstract field

272 views
Skip to first unread message

David Brian Holt

unread,
Feb 13, 2017, 4:52:45 PM2/13/17
to DSpace Technical Support
What's the easiest method to do this?

I see the instructions here but it looks like they're outdated: https://wiki.duraspace.org/pages/viewpage.action?pageId=19006441  

Thanks,

David

Terry Brady

unread,
Feb 13, 2017, 11:54:44 PM2/13/17
to David Brian Holt, DSpace Technical Support
I would consider breaking up the abstract field into 2 separate dc.description.abstract entries rather than relying on the XSLT to parse for newlines.

To help troubleshoot this issue, which version of DSpace are you running and which theme are you using?

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscribe@googlegroups.com.
To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.



--
Terry Brady
Applications Programmer Analyst
Georgetown University Library Information Technology
425-298-5498 (Seattle, WA)

David Brian Holt

unread,
Feb 14, 2017, 1:31:07 PM2/14/17
to DSpace Technical Support, holt...@gmail.com
I'm using Mirage2 on Dspace 6.  I tried your suggestion and it didn't work (it just appended the text).  Can I simply add a link break somewhere in the XSLT?

Thanks!


On Monday, February 13, 2017 at 8:54:44 PM UTC-8, Terry Brady wrote:
I would consider breaking up the abstract field into 2 separate dc.description.abstract entries rather than relying on the XSLT to parse for newlines.

To help troubleshoot this issue, which version of DSpace are you running and which theme are you using?
On Mon, Feb 13, 2017 at 1:52 PM, David Brian Holt <holt...@gmail.com> wrote:
What's the easiest method to do this?

I see the instructions here but it looks like they're outdated: https://wiki.duraspace.org/pages/viewpage.action?pageId=19006441  

Thanks,

David

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Terry Brady

unread,
Feb 14, 2017, 2:17:10 PM2/14/17
to David Brian Holt, DSpace Technical Support
The substring-before/substring-after logic in the initial code you shared would be the approach to find the insertion point for the line break/paragraph break.

To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscribe@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

David Brian Holt

unread,
Feb 14, 2017, 4:02:53 PM2/14/17
to DSpace Technical Support, holt...@gmail.com
I hope you don't mind, but can you tell me where that should go here?:

<xsl:template name="itemSummaryView-DIM-description">
        <xsl:if test="dim:field[@element='description']">
                 <div class="simple-item-view-description item-page-field-wrapper table">
                 <h5><i18n:text>xmlui.dri2xhtml.METS-1.0.item-description</i18n:text></h5>
                    <xsl:for-each select="dim:field[@element='description'][not(@qualifier)]">
                        <xsl:choose>
                            <xsl:when test="node()">
                                   <xsl:copy-of select="node()"/>                          
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:text>&#160;</xsl:text>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:for-each>                        
                </div>
        </xsl:if>
    </xsl:template>

Terry Brady

unread,
Feb 14, 2017, 4:45:56 PM2/14/17
to David Brian Holt, DSpace Technical Support
Here is a starting point inspired by the link you shared above.


I recommend that you first start with the SplitOnFirstNewline implementation to get a sense of how it works.

If that succeeds, use the SplitOnAllNewlines implementation to recursively find all newlines.

Terry


To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscribe@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

David Brian Holt

unread,
Feb 14, 2017, 5:01:57 PM2/14/17
to DSpace Technical Support, holt...@gmail.com
Thank you so much!  I tried that and at first it didn't give me a line break.   I then added a second <br/> and it then did give me a line break but also an extra space at the beginning of the new line.  I'll play around with this and try to figure it out. 

Thank you!

David Brian Holt

unread,
Feb 14, 2017, 6:26:29 PM2/14/17
to DSpace Technical Support, holt...@gmail.com
OK, I'm making some progress on this.  I used a closed <p> tag rather than <br> and that seemed to work but I'm still getting an extra space on the new line.

Here is what I have right now:

<xsl:template name="itemSummaryView-DIM-description">
        <xsl:if test="dim:field[@element='description']">
                 <div class="simple-item-view-description item-page-field-wrapper table">
                 <h5><i18n:text>xmlui.dri2xhtml.METS-1.0.item-description</i18n:text></h5>
                    <xsl:for-each select="dim:field[@element='description'][not(@qualifier)]">
                        <xsl:choose>
                            <xsl:when test="contains(., '&#xa;')">
                                   <xsl:value-of select="substring-before(., '&#xa;')"/>
                                   <p/>
                                   <xsl:value-of select="substring-after(., '&#xa;')"/>
                            </xsl:when>
                            <xsl:when test="node()">
                                   <xsl:copy-of select="node()"/>                          
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:text>&#160;</xsl:text>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:for-each>                       
                </div>
        </xsl:if>
    </xsl:template>

And this is what it produces:


Terry Brady

unread,
Feb 14, 2017, 7:42:05 PM2/14/17
to David Brian Holt, DSpace Technical Support
Try getting rid of the &#160; in the otherwise statement.

It is possible that is getting triggered by trailing space in your metadata.

--
You received this message because you are subscribed to the Google Groups "DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech+unsubscribe@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

David Brian Holt

unread,
Feb 14, 2017, 7:48:32 PM2/14/17
to DSpace Technical Support, holt...@gmail.com
That was it!  Thank you!  You're super awesome!  BTW, I worked for Jesuits (at Santa Clara) for 10 years before joining the federal courts.  Ad maiorem Dei gloriam!   :)

Thanks again!
To unsubscribe from this group and stop receiving emails from it, send an email to dspace-tech...@googlegroups.com.

To post to this group, send email to dspac...@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages