Hi,

On 05/06/12 05:59, Marcos DSpace wrote:
I trying to open a url in new window.

We solved that problem by using a new "rend" attribute, "newwindow", that we then translate accordingly in our xsl theme.

Below is our modified template for dri:xref (from elements.xsl, assuming you're using Mirage)
    <xsl:template match="dri:xref">
        <a>
            <xsl:if test="@target">
                <xsl:attribute name="href"><xsl:value-of select=< /span>"@target"/></xsl:attribute>
            </xsl:if>
            <xsl:if test="@rend">
                <xsl:attribute name="class"><xsl:value-of select="@rend"/></xsl:attribute>
                <xsl:if test="contains(@rend, 'newwindow')">
                    <xsl:attribute name="target"><xsl:text>_blank</xsl:text></xsl:attribute>
                </xsl:if>
            </xsl:if>
            <xsl:if test="@n">
                <xsl:attribute name="name"><xsl:value-of select="@n"/></xsl:attribute>
            </xsl:if>
            <xsl:apply-templates />
        </a>
    </xsl:template>

So with that, your Java code could then be
list.addItem().addXref([target], [text], "newwindow");
-- replace [target] with the URL you want to link to and [text] with the link text.

This will generate
<a href="" class="newwindow">[text]</a>
If you need additional CSS classes for that link, you can give them separated by spaces, eg "newwindow class".

I hope this helps.

cheers,
Andrea

-- 
Dr Andrea Schweer
IRR Technical Specialist, ITS Information Systems
The University of Waikato, Hamilton, New Zealand


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to