xslt-1.0

How to get the nearest ancestor or child of an ancestor with xpath

和自甴很熟 提交于 2019-12-23 11:22:32
问题 Look at <bookmark/> . The desired output I want is the id with value 5 <xsl:value-of select="//bookmark/ancestor::*[@id][1]/@id"/> only gives me 4 <?xml version="1.0" encoding="UTF-8"?> <content> <section id="1"> <section id="2"/> <section id="3"/> <section id="9"/> </section> <section id="4"> <section> <section id="10"/> <section id="5"/> <section> <bookmark/> <section id="6"> <section id="7"> <section id="8"/> </section> </section> </section> </section> </section> </content> 回答1: The way I

Grouping of a well defined flat XML for Access import (XSLT 1.0)

江枫思渺然 提交于 2019-12-23 05:26:16
问题 I have an output from our local accounting system, which consists of an envelope tag and just a repeated sequence of the fields, but not grouped. I have no prior experience in XSL but have been trying to find a solution for this and have found a solution, which works for XSLT 2.0. Unfortunately, it seems that Access 2007 only accepts XSLT 1.0 transformations. Can you please help me find a XSLT 1.0 solution that works? These are two records in the original flat XML: <ENVELOPE> <DBCFIXED>

Bit manipulation and string message structure with xslt

自古美人都是妖i 提交于 2019-12-23 04:46:13
问题 I need to convert a text string contained in a variable to an XML node. The mapping to the output XML is determined by a file named 'mapping.xml'. It has bit manipulation(checking if bit is 1). mapping.xml <Root> <field no="2" charlength="2">variable</field> <field no="3" total="4">fixed</field> <field no="21" charlength="2"> <subfield no="1" total="3">fixed</subfield> <subfield no="2" charlength="2" idcode="ABC">variable</subfield> </field> <field no="63" charlength="2"> <format1> <subfield

Convert XML to CSV with XSLT

十年热恋 提交于 2019-12-23 04:43:47
问题 I'd like to convert XML into CSV using an XSLT.Could please someone help me to rearrange the XSL file so that each data, if it exists, is correctly stored in the columns according to the header. Otherwise the column must remain empty. My inputs are XML file: <?xml version="1.0" encoding="ISO-8859-1"?> <message version="2.0" system="avs/3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <header> <creation-date>2016-10-06</creation-date> <creation-time>10:46:00</creation-time> </header>

XSLT1.0 Rendering sequence of different elements stored in a variable as M x N table

对着背影说爱祢 提交于 2019-12-23 02:47:26
问题 I have the following XML (it is simplified and most attributes are omitted): <Document> <Transfer Name="" From="" To=""/> <Transfer Name="" From="" To=""/> <OtherElement/> <OtherElement/> <Flight AirLina="" From="" To=""/> <Flight AirLina="" From="" To=""/> <OtherElement/> <Hotel Name="" Duration=""/> <Hotel Name="" Duration=""/> <OtherElement/> <OtherElement/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/> <Extras Name="" Price=""/

Groups two xml files like a sql group-by

孤人 提交于 2019-12-23 02:47:05
问题 With the following file as input of xsltprocessor : mylibrary.xml : <library> <book isbn="1"/> <book isbn="3"/> <book isbn="5"/> </library> and this one that can be used : bookreference.xml : <reference> <book isbn="1"> <category>SF</category> </book> <book isbn="2"> <category>SF</category> </book> <book isbn="3"> <category>SF</category> </book> <book isbn="4"> <category>Comedy</category> </book> <book isbn="5"> <category>Comedy</category> </book> </reference> i want to get the numbers of

Using XSLT to create a well formatted nested table from unknown XML

让人想犯罪 __ 提交于 2019-12-23 02:43:07
问题 The task I was given: My boss wants me to create an XSLT that takes XML of an unknown structure, and put it into a nested table (tag names as table headers) without repeating table headers where possible. I was almost able to get what he wants (The table ) The question: I have only worked with XSLT's for a few days now (have gone through a few tutorials and played with it a bit), So if anyone can point me in a good direction on where to find information that will help me with my problem, it

XSLT - remove all attributes

佐手、 提交于 2019-12-22 15:23:14
问题 Pretty straightforward question. Didn't find an answer to exactly this one. Would like to see XSLT 1.0 without attribute axis, and others too if possible (I am using python's lxml lib which is not really catching up on that stuff). 回答1: Your solution should work without issue, but there's an even easier way - just use an identity template that doesn't include attributes: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes"

Concat Strings to numbers using Recursive

╄→гoц情女王★ 提交于 2019-12-22 11:25:09
问题 XML coding is given below <math> <mn> <mphantom>12</mphantom> </mn> </math> Output required: <?xml version='1.0' encoding='UTF-8'?> <math>|phantom1||phantom2|</math> XSLT tried: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cl="http://xml.cengage-learning.com/cendoc-core" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999

XSLT Recursive Parent/Child Combination

白昼怎懂夜的黑 提交于 2019-12-22 11:20:43
问题 Very interesting Python bounty question which I know can be solved with XSLT 1.0. Please note this is not a duplicate question as previous post centered on Python methods while this is attempting an XSLT solution to the same problem. Below is my attempt but is constrained to a pre-set number of parent/child combinations here being four levels deep and walks through each level conditionally. Is there a way to generalize my solution for any combination level? I understand this may require