Re: [xsl] new: how to change value of attributes

Subject: Re: [xsl] new: how to change value of attributes
From: "Martin Honnen" Martin.Honnen@xxxxxx
Date: Fri, 27 Nov 2009 18:16:26 +0100
> ivanmacculi@xxxxxxxxx wrote:
> > I've problems with Michael Kay suggestion:
> > 1) Oxygen tells me to declare f: namespace and xs: namespace:
> > <xsl:function name=3D"f:index-of-node" as=3D"xs:integer*">.
> 
> The xs namespace needs to be http://www.w3.org/2001/XMLSchema so put
>   xmlns:xs=3D"http://www.w3.org/2001/XMLSchema";
> on your xsl:stylesheet element.
> To define your own functions you are free to choose a namespace but you=
 
> need to choose one.
> 
> > 2) <xsl:template match=3D"*[. intersect $g]/@LABEL"> is open but not =
closed. Where can i close it? thank you so much.
> 
> I think Michael's suggestion is to replace
> 
>    <xsl:template match=3D"mets:div/@LABEL[matches(., '^Pagina [0-9]+$')=
]">
>      <xsl:variable name=3D"n">
>        <xsl:number level=3D"any" count=3D"mets:div[@LABEL[matches(., 
> '^Pagina [0-9]+$')]]"/>
>      </xsl:variable>
>      <xsl:attribute name=3D"LABEL" select=3D"concat('Carta ', if ($n mo=
d 2 =3D 
> 0) then concat(($n + 1) idiv 2, 'v') else concat(($n + 1) idiv 2, 'r'))=
"/>
>    </xsl:template>
> 
> in the solution I posted with
> 
> <xsl:variable name=3D"g" select=3D"//mets:div[matches(@LABEL, '^Pagina
> [0-9]+$')]"/>
> 
> <xsl:template match=3D"*[. intersect $g]/@LABEL">
>    <xsl:variable name=3D"n" select=3D"f:index-of-node($g, ..)"/>
>      <xsl:attribute name=3D"LABEL" select=3D"concat('Carta ', if ($n mo=
d 2 =3D 
> 0) then concat(($n + 1) idiv 2, 'v') else concat(($n + 1) idiv 2, 'r'))=
"/>
> </xsl:template>
> 
> plus the function he posted.
> 
> 
> 
> -- 
> 
> 	Martin Honnen
> 	http://msmvps.com/blogs/martin_honnen/

Current Thread