xslt-2.0

XSLT: If tag exists, apply template; if not, choose static value

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-21 03:36:21
问题 I am new to XSLT in general so please bear with me... With that in mind, what I am trying to do is check for a certain tag in the XML. If it is there I want to apply a template. If not, I want to add it (as a blank value). Basically always forcing it to be in the final output. How would I do this? I had something like this... <xsl:choose> <xsl:when test="@href"> <xsl:apply-templates select="country" /> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> The top poriton of the code is

Change XML element name using XSLT

ぃ、小莉子 提交于 2019-12-20 06:47:17
问题 I am trying to change XML node name but it doesn't allow me to do so. In my below code I I have two templates 1. Change Node name 2.Create parent node for DocumentReference. Please see my XML and XSLT. My XML <?xml version="1.0" encoding="UTF-8" standalone="no"?> <DataArea> <PurchaseOrder> <PurchaseOrderLine> <DocumentReference> <DocumentID> <ID>23423</ID> </DocumentID> </DocumentReference> <DocumentReference> <DocumentID> <ID>23424</ID> </DocumentID> </DocumentReference> <Item>

Convert string to binary base64

江枫思渺然 提交于 2019-12-20 06:28:48
问题 Is there any way on how to convert a string to binary base64? I've seen many references but it didn't work in my end. For example I have this input file: <RootElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Data> <Binary> <RawData>This element should convert string to binary base64.</RawData> </Binary> </Data> </RootElement> I need to generate: <RootElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001

XML-XSLT : How to compare two dates which are in String

别等时光非礼了梦想. 提交于 2019-12-20 06:17:39
问题 I know this question might get repeated and also I have went through similar articles and question but I have not found the exact solution. Now the question I am using XSLT or XPATH to transform the xml. Here in XML two string variables are there. one is OldDate and second is CurrentDate . Ex : $oldDate = '29.05.2015 15:25:06' $currentDate ='27.07.2015 14:28:02'. Now I want to compare those two dates. If $oldDate > $currentDate then 'OK' else 'Not Ok'. As I am new to use XSLT and XPATH I did

eXist - loading XSLT collection() - Exception thrown by URIResolver

非 Y 不嫁゛ 提交于 2019-12-20 06:15:54
问题 Environment: eXist-db 4.2.1 , XQuery 3.1, XSLT 2.0 In eXist-db I am loading an XSLT file which includes a reference to a collection in eXist (in order to perform a search on documents found there, using a key). This reference seems to throw an error from Saxon. Exception while transforming node: Exception thrown by URIResolver XML docs are located at /db/apps/deheresi/data/ XSLT docs are located at /db/apps/deheresi/data/styles In the transform function, I am passing a parameter from XQuery

Applying XSLT v. 2 on XML

旧城冷巷雨未停 提交于 2019-12-20 04:35:17
问题 I had written an XSLT 2.0 version file and when it is applied to an XML file it gives me following error: ERROR: 'Unsupported XSL element 'http://www.w3.org/1999/XSL/Transform:sequence'' This is the Java code: TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource("Test.xslt")); transformer.transform(new StreamSource("Old.xml"),new StreamResult(new FileOutputStream("New.xml"))); Can someone help me out with this? 回答1:

How to get the Particular XML elements indexes with respect to this scenario in xslt 2.0?

流过昼夜 提交于 2019-12-20 03:29:27
问题 I want to convert one xml to another xml by using XSLT2.0.While doing so, i want to find out some XML elements indexes with respect to my scenaio i explained here... This is XML Document : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"> <w:body> <w:sdt> <w:sdtContent> <w:p> <w:pPr> <w:pStyle w:val="TOC"></w:pStyle> </w:pPr> </w:p> </w:sdtContent> </w:sdt> <w:p> <!-- index value 0 --> </w:p> <w:p> <!--

xslt sort output xml

对着背影说爱祢 提交于 2019-12-19 04:06:12
问题 I'm trying to find a solution to the following problem. I'm developing XSLT transformation (which is now about 40KB big) that is transforming quite complex XMLs into a quite simple structure which would like this: <Records> <Record key="XX"> </Record> <Record key="XX1"> </Record> <Record key="XX2"> </Record> <Record key="XX3"> </Record> </Records> I would like to have this output XML sorted according to Records/Record/@key values. The problem is that my XSLT produces this output unsorted and

To compare two elements(string type) in XSLT?

左心房为你撑大大i 提交于 2019-12-18 19:05:45
问题 i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: <OU_NAME>Vision Operations</OU_NAME> --XML code <OU_ADDR1>90 Fifth Avenue</OU_ADDR1> --XML code <xsl:choose> <xsl:when test="OU_NAME='OU_ADDR1'"> --comparing two elements coming from XML <!--remove if adrees already contain operating unit name <xsl:value-of select="OU_NAME"/> <fo:block/>--> <xsl:if test="OU_ADDR1 !='' "> <xsl:value-of select="OU_ADDR1"/> <fo:block/> </xsl

To compare two elements(string type) in XSLT?

时光怂恿深爱的人放手 提交于 2019-12-18 19:05:17
问题 i am new to XSLT ,can any one please suggest to me how to compare two elements coming from xml as string their values are: <OU_NAME>Vision Operations</OU_NAME> --XML code <OU_ADDR1>90 Fifth Avenue</OU_ADDR1> --XML code <xsl:choose> <xsl:when test="OU_NAME='OU_ADDR1'"> --comparing two elements coming from XML <!--remove if adrees already contain operating unit name <xsl:value-of select="OU_NAME"/> <fo:block/>--> <xsl:if test="OU_ADDR1 !='' "> <xsl:value-of select="OU_ADDR1"/> <fo:block/> </xsl