[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Doing math in XSLT?
I don't recognize the use of {} in the comment. Can you use value-of and select the result? I'm outputting text not xml, so the comment wouldn't work.That was the minimal code in my example. I'll see if I can extract something fuller but simple.Sent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 4/1/24 11:43 AM (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Doing math in XSLT? On 01/04/2024 20:37, dvint@xxxxxxxxx wrote:> I have the following XML>> <row>> B B B B <entry nameend="col2" namest="col1">> B B B B B B B <p>OpenID Connect client settings</p>> B B B B B B B <note> B B B B B B B B B B B id="note_N1055C"> B B B B B B B B B B B >The following parameters are only applicable> B B B B B B B B B B B when this client supports the OpenID Connect use> B B B B B B B B B B B cases.</note>> B B B B </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"> B B B B select="number(substring-after(@namest, 'col'))" as="xs:double"/>> <xsl:variable name="end"> B B B B 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.For me a template B <xsl:template match="entry"><xsl:variable name="start" B B B select="number(substring-after(@namest, 'col'))" as="xs:double"/><xsl:variable name="end" B B B select="number(substring-after(@nameend, 'col'))" as="xs:double"/> B B B <xsl:comment>{$end - $start + 1}</xsl:comment> B </xsl:template>doesn't give any error with Saxon HE 12 and outputs e.g. <!--2--> foryour sample XML.Please show us minimal but complete code that gives that error and tellus which XSLT processor and version you use.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|