[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: how to change the values of a list of attribute e

Subject: RE: how to change the values of a list of attribute excluding one or more of these.
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 27 Nov 2009 18:11:08 -0000
RE:  how to change the values of a list of attribute  e
I'm not sure in what sense "Pagina 59" is the first in your list - your
input and output lists don't seem to correspond. But you can of course
remove the first in the list by changing the variable from

> <xsl:variable name="g" select="//mets:div[matches(@LABEL, '^Pagina
[0-9]+$')]"/>

to

<xsl:variable name="g" select="remove(//mets:div[matches(@LABEL, '^Pagina
[0-9]+$')], 1)"/>

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

 

> -----Original Message-----
> From: ivanmacculi@xxxxxxxxx [mailto:ivanmacculi@xxxxxxxxx] 
> Sent: 27 November 2009 13:41
> To: XSL user
> Subject:  how to change the values of a list of 
> attribute excluding one or more of these.
> 
> Yesterday i asked you how to change the values of a 
> enumerated list of attributes building the string of the new 
> values: the list is something like this:
> 
> <mets:div LABEL="Canto VI" ORDER="8" ORDERLABEL="1">
>                     <mets:div LABEL="Pagina 56">
>                         <mets:fptr FILEID="file.00059"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 57">
>                         <mets:fptr FILEID="file.00060"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 58">
>                         <mets:fptr FILEID="file.00061"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 59">
>                         <mets:fptr FILEID="file.00062"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 60">
>                         <mets:fptr FILEID="file.00063"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 61">
>                         <mets:fptr FILEID="file.00064"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 62">
>                         <mets:fptr FILEID="file.00065"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 63">
>                         <mets:fptr FILEID="file.00066"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 64">
>                         <mets:fptr FILEID="file.00067"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 65">
>                         <mets:fptr FILEID="file.00068"/>
>                     </mets:div>
>                     <mets:div LABEL="Pagina 66">
>                         <mets:fptr FILEID="file.00069"/>
>                     </mets:div>
>                 </mets:div>
> 
> 
> Mickael Kay suggested:
> 
> 
> <xsl:variable name="g" select="//mets:div[matches(@LABEL, 
> '^Pagina [0-9]+$')]"/>
> 
> <xsl:template match="*[. intersect $g]/@LABEL"> <xsl:variable 
> name="n" select="f:index-of-node($g, .)"/>
> 
> where
> 
> <xsl:function name="f:index-of-node" as="xs:integer*"> 
> <xsl:param name="nodes" as="node()*"/> <xsl:param name="node" 
> as="node()"/> <xsl:for-each select="$nodes"> <xsl:sequence 
> select="position()[current() is $node]"/> </xsl:for-each> 
> </xsl:function>
> 
> to transform that one in this new list:
> 
> 
>  <mets:div LABEL="Canto XI" ORDER="13" ORDERLABEL="1">
>                     <mets:div LABEL="Carta [59r]" ORDER="1" 
> ORDERLABEL="113">
>                         <mets:fptr FILEID="file.00116"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [59v]" ORDER="2" 
> ORDERLABEL="114">
>                         <mets:fptr FILEID="file.00117"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [60r]" ORDER="3" 
> ORDERLABEL="115">
>                         <mets:fptr FILEID="file.00118"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [60v]" ORDER="4" 
> ORDERLABEL="116">
>                         <mets:fptr FILEID="file.00119"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [61r]" ORDER="5" 
> ORDERLABEL="117">
>                         <mets:fptr FILEID="file.00120"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [61v]" ORDER="6" 
> ORDERLABEL="118">
>                         <mets:fptr FILEID="file.00121"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [62r]" ORDER="7" 
> ORDERLABEL="119">
>                         <mets:fptr FILEID="file.00122"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [62v]" ORDER="8" 
> ORDERLABEL="120">
>                         <mets:fptr FILEID="file.00123"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [63r]" ORDER="9" 
> ORDERLABEL="121">
>                         <mets:fptr FILEID="file.00124"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [63v]" ORDER="10" 
> ORDERLABEL="122">
>                         <mets:fptr FILEID="file.00125"/>
>                     </mets:div>
>                     <mets:div LABEL="Carta [64r]" ORDER="11" 
> ORDERLABEL="123">
>                         <mets:fptr FILEID="file.00126"/>
>                     </mets:div>
>                 </mets:div>
> 
> i forgot to ask you how to exclude from the transformation 
> the first one of the list, in this case:
> 
> <mets:div LABEL="Pagina 59">
> <mets:fptr FILEID="file.00116"/>
> </mets:div>
> 
> is it possible? thx.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.