xslt

Xpath Predicate to match <![CDATA[sometext]]>

心已入冬 提交于 2020-01-17 01:19:20
问题 My xml element content is having special characters like <,>,[,]. I want to find element macthing the content <![CDATA[someText]]> and replace it with some new value like <![CDATA[newValue]]> . <property name="sourcePath"> <string><![CDATA[someText]]></string> </property>` I am trying to do this using below xsl template. But it is not working. <xsl:template match="property[string='<![CDATA[someText]]>']"> <xsl:element name="string"> <xsl:text disable-output-escaping="yes"><![CDATA[newValue]]>

XSL - store unique and sorted data in a variable

痴心易碎 提交于 2020-01-16 19:43:13
问题 Using XSLT 2.0 and Apache FOP I want to be able to create a new variable, have unique and sorted values inside it by category but preserve the nodes. So the new variable should have the following nodes: <category>1. First Aid</category> <category>2. Access control</category> <category>3. Fire safety</category> <category>4. Recognition</category> The input XML is the following: <equipment> <E0132> <category>1. First Aid</category> <description>Lorem ipsum dolor sit amet, consectetur adipiscing

Transform XML to add 'nil' attributes to empty elements

感情迁移 提交于 2020-01-16 19:35:50
问题 An existing XML feed we consume has a lot of properties whose values can be missing, and we want to treat these as NULL not optional or empty values because it makes enforcing strict typing harder and messes up our auto code generation and so on. For instance we might receive: <LASTUPDATED/> We have no formal XSD but are creating one ourselves... it might currently look like: <xs:element type="xs:dateTime" name="LASTUPDATED"/> This doesn't validate against the XML shown ( "" is not a valid

Xpath: Select node from within document node variable for each loop

故事扮演 提交于 2020-01-16 19:21:05
问题 I came across an expected problem and I am wondering whether there's a solution better than mine. So, I have a document node variable: <xsl:variable name="variableNode" as="document-node()"> <xsl:document> <root> <element>...content...</element> <root> </xsl:document> </xsl:variable> The content of this document node variable is processed later by a for-each loop: <xsl:for-each select="$variableNode/root/element"> ...content... </xsl:for-each> From within the content of this for-each loop I

XSL Transform with three source documents to create report

邮差的信 提交于 2020-01-16 18:17:46
问题 I'm having difficulty creating an xsl transformation. My three source documents are similar to: <dsQueryResponse> <Workgroup> <Items> <Item WorkgroupID="4001" WorkgroupCenter="Center1"/> <Item WorkgroupID="4002" WorkgroupCenter="Center1"/> <Item WorkgroupID="4003" WorkgroupCenter="Center2"/> </Items> </Workgroup> <Staff> <Items> <Item StaffName="Anne Jones" StaffCenter="Center1" StaffID="AJ1" /> <Item StaffName="Bill Smith" StaffCenter="Center1" StaffID="BS1" /> <Item StaffName="Charles

XSL Transform with three source documents to create report

旧巷老猫 提交于 2020-01-16 18:17:30
问题 I'm having difficulty creating an xsl transformation. My three source documents are similar to: <dsQueryResponse> <Workgroup> <Items> <Item WorkgroupID="4001" WorkgroupCenter="Center1"/> <Item WorkgroupID="4002" WorkgroupCenter="Center1"/> <Item WorkgroupID="4003" WorkgroupCenter="Center2"/> </Items> </Workgroup> <Staff> <Items> <Item StaffName="Anne Jones" StaffCenter="Center1" StaffID="AJ1" /> <Item StaffName="Bill Smith" StaffCenter="Center1" StaffID="BS1" /> <Item StaffName="Charles

XSL producing HTML can not insert HTML fragments from XML

人盡茶涼 提交于 2020-01-16 18:11:26
问题 What I want to achieve: 1 XSL file produces an HTML output based on XSLT. Parts of the output HTML is stored in XML. So you need to read that part from an XML and insert it (merge) with the other content that XSL directly produces. Example Code XSL : <div> <h1>This is a title</h1> <p>And this is the content coming from XML:<br/> <xsl:copy-of select="/*/xhtml:myelement" /> </p> </div> And the XML looks like this: <?xml version="1.0" encoding="UTF-8"?> <z:article xmlns:ns0="http://www.w3.org

Call XSLT file from data:text/xml

不羁的心 提交于 2020-01-16 16:32:09
问题 Have a nice day everybody i'm trying to call a XSLT file from an XML that i'm rendering using data:text/xml, obtained from a REST. The most basic attempt is to use this line of code: window.open( 'data:text/xml,' + encodeURIComponent( responseData ) ); another attempt of mine is to open it in a modal iframe (with angular-material) setting up the src with the xml data, both tests opens the XML with the URL but with this error: Error loading the stylesheet: unknown error (805303f4) I have test

Removing certain XML elements via XSLT

こ雲淡風輕ζ 提交于 2020-01-16 09:55:08
问题 My problem is: I have an XML file where I want to remove some child elements without removing parents. Can anyone help me to get the result by using ASP.NET? Here is my XML file: <Jobs> <Job> <Title></Title> <Summary</Summary> <DateActive>9/28/2009</DateActive> <DateExpires>10/28/2009</DateExpires> <DateUpdated>9/28/2009</DateUpdated> <Location> <Country>India</Country> <State>xxx</State> <City>xxx</City> <PostalCode>xxx</PostalCode> </Location> <CompanyName>Finance</CompanyName> <Salary>

Flattening a hierarchy while deduping nested values using XSLT

ε祈祈猫儿з 提交于 2020-01-16 09:02:15
问题 I am brand new to xml transforms and am attempting to transform an existing XML structure by flattening the information at the same time deduping nested fields but it looks like not all the data is able to be transformed. Based on some of the limitations of the data, I need to substring some information from the source xml and dedupe that information as well as provide a new id for each product. After some trouble I was able to get it to work on a smaller subset but am noticing that when I