Re: [xsl] Doing math in XSLT?

Subject: Re: [xsl] Doing math in XSLT?
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Apr 2024 19:32:27 -0000
On Mon, Apr 1, 2024 at 12:23b/PM Michael Kay mike@xxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> My guess is that you've got the context wrong, i.e. that @namest and
> @nameend are not selecting anything because the `<entry>` element isn't the
> context item.
>
> It's only a guess, but the code you've shown us is correct, which means
> the error must be in the code you haven't shown us, and that makes a
> context error a strong candidate.
>


And on April 1st everything is possible ... :)

What about a default namespace problem? :)

Thanks,
Dimitre


>
> Michael Kay
> Saxonica
>
> > On 1 Apr 2024, at 19:37, dvint@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > I have the following XML
> >
> > <row>
> >       <entry nameend="col2" namest="col1">
> >               <p>OpenID Connect client settings</p>
> >               <note
> >                       id="note_N1055C"
> >                       >The following parameters are only applicable
> >                       when this client supports the OpenID Connect use
> >                       cases.</note>
> >       </entry>
> > </row>
> >
> > The attributes nameend="col2" namest="col1" indicate that this row spans
> 2 columns (end - start + 1).
> >
> > I've tried this to try and get the numbers 1 and 2 from these strings,
> but I get NaN errors
> >
> > <xsl:variable name="start"
> >       select="number(substring-after(@namest, 'col'))" as="xs:double"/>
> > <xsl:variable name="end"
> >       select="number(substring-after(@nameend, 'col'))" as="xs:double"/>
> >
> > I've tried this in different combinations with/without the
> as="xs:double" and number() and those variations throw the same error.
> >
> > The table itself has this information
> >
> > <table colsep="0" frame="none" id="table_post_oauthClients_endpoints"
> >       rowsep="0">
> >       <tgroup align="left" cols="2">
> >               <colspec colname="col1" colnum="1" colwidth="1*"/>
> >               <colspec colname="col2" colnum="2" colwidth="3*"/>
> >               <thead>
> >                       <row>
> >                               <entry colname="col1">Parameter</entry>
> >                               <entry colname="col2">Description</entry>
> >                       </row>
> >               </thead>
> >
> > I'll try referencing the <colspec> element and using the @column value,
> but that seems like it will give me the same issue.
> >
> > ..dan

Current Thread