xslt

How to convert a negative decimal into hexadecimal using xslt 1

我的未来我决定 提交于 2020-01-11 13:47:13
问题 I would like to convert negative and positive decimal into hexadecimal using xslt 1.0. There's already a topic related to this question here but the answer is given using xslt 2.0. I tried to reproduce the template using xslt 1.0 but it always returns an empty value. <xsl:template name="convertDecToHex"> <xsl:param name="pInt" /> <xsl:variable name="vMinusOneHex64"><xsl:number>18446744073709551615</xsl:number></xsl:variable> <xsl:variable name="vCompl"> <xsl:choose> <xsl:when test="$pInt > 0"

I am able to output almost all the XML element contents into a table except the value of (Local =“No”)

眉间皱痕 提交于 2020-01-11 13:29:28
问题 I am a trying to write an xsl code for the folling xml code, and so far i am able to output almost all the element contents into a table except the value of (Local ="No") which is in the food element tag. Is there a way to output that attribute and its value. Thank you. <FoodItems> <food Local = "No" > <Name>Rice</Name> <Brand>Jasmine</Brand> <Price>$89</price> <Grade>A</grade> </food> </FoodItems> 来源: https://stackoverflow.com/questions/33421194/i-am-able-to-output-almost-all-the-xml-element

Get value after each last colon

♀尐吖头ヾ 提交于 2020-01-11 13:07:08
问题 I need to get the value of each data after the last colon. For example, I have this file: <Data> :20:PmtReferenceID000012 :21:Not used :25: PHMNLBICXXX/Account00010203 :28c:00001/0001 (The 'c' in :28 can be either in upper or lower case) :20:PmtReferenceID000012 :21:Not used :25: PHMNLBICXXX/Account00010203 :28c:00001/0001 (The 'c' in :28 can be either in upper or lower case) </Data> I need to store the value after the ':20:' to <ABCD> , ':21:' to <EFGH> , ':25:' to <IJKL> and ':28c:' to

XSLT transformation to xml, grouping by key

拈花ヽ惹草 提交于 2020-01-11 11:09:22
问题 I have problem with write xsl to transform my xml to raport version. It looks like that: <library> <authors> <author id="1001">John</author> <author id="1002">Tom</author> </authors> <articles> <article> <authorId>1001</authorId> <title>Article1</title> </article> <article> <authorId>1002</authorId> <title>Article2</title> </article> <article> <authorId>1001</authorId> <title>Article3</title> </article> </articles> </library> I want to tranform it to: <raport> <authorArticles> <author>John<

Transform From one JAXB object to another using XSLT template

假如想象 提交于 2020-01-11 10:58:47
问题 Is there a way to transform a JAXB generated object to another JAXB object using an XSLT template file. The two objects are generated by two different JAXB bindings. I know that I can marshall the object to strings and then using a XSLT processor to transform it to the other format. After that unmarshall it to the other JAXB object. The question is if this is possible in to do in JAXB. 回答1: I don't think its possible without any intermediate serialization or dom tree construction, but

Pass xml document as parameter to xsl

余生颓废 提交于 2020-01-11 09:53:50
问题 I have read a lot of post and tried a lot of things but still can't get the xsl to find values in the parameter. I started with java's sun xalan and never got it working so I switched to saxon to no avail. I want to combine two xml docs into one with xls. Never are on a file system, this is for a web app that builds xml strings/ docs. I have tried passing an DTMAxisIterator, DomSource , Doc to Node set in xsl, string. It worked fine in NotePad++ with an xsl document() but I don't want to save

Need to assign attribute value in single quote xslt

≡放荡痞女 提交于 2020-01-11 09:48:32
问题 we need to create a html from xml using xslt transformation. We require the resulting html anchor tag as <a> <xsl:attribute name="href"> <xsl:value-of select="Google-Link" /> </xsl:attribute> </a> output html has href attribute value in double quotes <a href="http://google.com">google</a> but we want it to be in single quotes <a href='http://google.com'>google</a> 回答1: Unless the vendor of your XSLT processor gives you an extension to request this, it is out of your hands. Such serialization

Java/XSLT: Cannot find a matching 1-argument function

隐身守侯 提交于 2020-01-11 08:29:24
问题 I get the following error: javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate() at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774) The top of my xslt file is <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt

Formatting numbers, excluding trailing zeroes

风流意气都作罢 提交于 2020-01-11 07:52:06
问题 first time SO user :) I know that I can format a number like this: format-number($value, '###,###.00') But I would like to remove the dot and the zeroes if $value is zero. So, 37368 -> 37,368 2.666667 -> 2.66 Is this possible using just number formatting (doesn't seem like it) or do I have to do something along the lines of if (int(value) == value ) {...} 回答1: format-number($value, '###,###.##') 回答2: xpath 2.0 contains conditional logic if..then..else but in the more likely case that you're

How to transform XML to HTML with XSLT in C#?

[亡魂溺海] 提交于 2020-01-11 07:20:12
问题 How can I transform XML to HTML with XSLT in ASP.NET Core? I thought about: public static string TransformXMLToHTML(string inputXml, string xsltString) { XslCompiledTransform transform = new XslCompiledTransform(); using(XmlReader reader = XmlReader.Create(new StringReader(xsltString))) { transform.Load(reader); } StringWriter results = new StringWriter(); using(XmlReader reader = XmlReader.Create(new StringReader(inputXml))) { transform.Transform(reader, null, results); } return results