Jose Blanco | 26 Jun 2012 20:40
Picon

looking for xslt example using filtering

I'm looking for an example of how to filter out a value for display.  I'm trying to use this logic to change something in the short item display.  So, for example,

Given:
<a>123_abc</a>
<a>456_abc</a>
<a>789_abc</a>

if <a> does NOT contain 123, display this:

Label: 456_abc
          789_abc

in the case where <a> only contains 123, don't display anything.

So if you have
<a>123_abc</a>

You should not display anything - just skip it.

Thank you!
Jose

------------------------------------------------------------------------------
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/
------------------------------------------------------------------------------
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/
helix84 | 26 Jun 2012 21:00
Picon
Favicon
Gravatar

Re: looking for xslt example using filtering

Here's a template that will do it. It could be simpler, but I tried to
make it illustrate the concept. Let me know if there is something you
don't understand.

<xsl:template match="a">
    <xsl:choose>
        <xsl:when test=". != '123_abc'">
            <xsl:copy-of select="." />
        </xsl:when>
        <xsl:otherwise>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

Regards,
~~helix84

------------------------------------------------------------------------------
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/
Jose Blanco | 26 Jun 2012 21:22
Picon

Re: looking for xslt example using filtering

I think in both of these cases the Label will be printed in each line.  I want Label only to appear in the 1st line.

I'm thinking of using a variable to contain all the nodes I need, so I have this so far ( note that now the example has to do with what I'm actually working on )

            <xsl:variable name='alluris' select="dim:field[ <at> element='identifier' and <at> qualifier='uri']"></xsl:variable>

But what I really want is for the variable alluris to contain all the uris except the handle, so I want to add something like this:

not(contains(./node(),'OUR_HANDLE_PRFIX'))

to the variable, but how do I add that to the to the select in the variable declaration (syntax)?

I think once I have a list of things I want to display, I can go from there.

Thank you!
Jose


On Tue, Jun 26, 2012 at 3:00 PM, helix84 <helix84-aRb0bU7PRFM1O8qKqF6upA@public.gmane.org> wrote:
Here's a template that will do it. It could be simpler, but I tried to
make it illustrate the concept. Let me know if there is something you
don't understand.

<xsl:template match="a">
   <xsl:choose>
       <xsl:when test=". != '123_abc'">
           <xsl:copy-of select="." />
       </xsl:when>
       <xsl:otherwise>
       </xsl:otherwise>
   </xsl:choose>
</xsl:template>

Regards,
~~helix84

------------------------------------------------------------------------------
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
DSpace-tech-5NWGOfrQmnd4wTydcyPnfg@public.gmane.orgceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

------------------------------------------------------------------------------
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/
------------------------------------------------------------------------------
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/
helix84 | 26 Jun 2012 21:30
Picon
Favicon
Gravatar

Re: looking for xslt example using filtering

On Tue, Jun 26, 2012 at 9:22 PM, Jose Blanco <blancoj <at> umich.edu> wrote:
> I think in both of these cases the Label will be printed in each line.  I
> want Label only to appear in the 1st line.

I don't understand. What do you mean by lines?

> I'm thinking of using a variable to contain all the nodes I need, so I have
> But what I really want is for the variable alluris to contain all the uris
> except the handle, so I want to add something like this:
>
> not(contains(./node(),'OUR_HANDLE_PRFIX'))
>
> to the variable, but how do I add that to the to the select in the variable
> declaration (syntax)?

Here are two ways to achieve the same thing. If the node doesn't
contain OUR_HANDLE_PREFIX, the variable will be assigned an empty
string.

<xsl:variable name='alluris'>
    <xsl:if test="not(contains(./node(),'OUR_HANDLE_PREFIX'))">
        <xsl:value-of select="dim:field[ <at> element='identifier' and
 <at> qualifier='uri']">
    </xsl:if>
</xsl:variable>

<xsl:choose>
    <xsl:when test="not(contains(./node(),'OUR_HANDLE_PREFIX'))">
        <xsl:variable name='alluris'
select="dim:field[ <at> element='identifier' and
 <at> qualifier='uri']"></xsl:variable>
    </xsl:when>
    <xsl:otherwise>
    </xsl:otherwise>
</xsl:choose>

Also note that "." is equivalent to "./node()".

Regards,
~~helix84

------------------------------------------------------------------------------
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
DSpace-tech <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
Jose Blanco | 26 Jun 2012 21:30
Picon

Re: looking for xslt example using filtering

I think I got it.  Here is what I have (TEMP-BOGUS is our handle prefix in dev. ):

      <xsl:variable name='alluris' select="dim:field[ <at> element='identifier' and <at> qualifier='uri'][not(contains(.,'TEMP-BOGUS'))]"></xsl:variable>

Thanks!


On Tue, Jun 26, 2012 at 3:22 PM, Jose Blanco <blancoj-63aXycvo3TyHXe+LvDLADg@public.gmane.org> wrote:
I think in both of these cases the Label will be printed in each line.  I want Label only to appear in the 1st line.

I'm thinking of using a variable to contain all the nodes I need, so I have this so far ( note that now the example has to do with what I'm actually working on )

            <xsl:variable name='alluris' select="dim:field[ <at> element='identifier' and <at> qualifier='uri']"></xsl:variable>

But what I really want is for the variable alluris to contain all the uris except the handle, so I want to add something like this:

not(contains(./node(),'OUR_HANDLE_PRFIX'))

to the variable, but how do I add that to the to the select in the variable declaration (syntax)?

I think once I have a list of things I want to display, I can go from there.

Thank you!
Jose



On Tue, Jun 26, 2012 at 3:00 PM, helix84 <helix84-aRb0bU7PRFM1O8qKqF6upA@public.gmane.org> wrote:
Here's a template that will do it. It could be simpler, but I tried to
make it illustrate the concept. Let me know if there is something you
don't understand.

<xsl:template match="a">
   <xsl:choose>
       <xsl:when test=". != '123_abc'">
           <xsl:copy-of select="." />
       </xsl:when>
       <xsl:otherwise>
       </xsl:otherwise>
   </xsl:choose>
</xsl:template>

Regards,
~~helix84

------------------------------------------------------------------------------
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
DSpace-tech-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/dspace-tech


------------------------------------------------------------------------------
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/
------------------------------------------------------------------------------
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/
helix84 | 26 Jun 2012 21:32
Picon
Favicon
Gravatar

Re: looking for xslt example using filtering

On Tue, Jun 26, 2012 at 9:30 PM, Jose Blanco <blancoj <at> umich.edu> wrote:
>       <xsl:variable name='alluris' select="dim:field[ <at> element='identifier'
> and  <at> qualifier='uri'][not(contains(.,'TEMP-BOGUS'))]"></xsl:variable>

Yes, that's another possible notation. And the most concise.

Regards,
~~helix84

------------------------------------------------------------------------------
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
DSpace-tech <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Gmane