xslt-1.0

document() function for a file on another computer/server

落花浮王杯 提交于 2019-12-12 05:31:34
问题 I understand the use of document() as follows. <xsl:value-of select="document('path\to\docuemnt.xml')/RootElement/Element"/> And this has to be a relative path to the parent XSL file. But what if I need to reference a file which is hosted on another server on the local network? I've tried such things as. <xsl:value-of select="document('\\servername\path\to\document.xml')/RootElement/Element"/> But this throws an error, because it looks in C:\path\to\xsl\\servername\path\to\document.xml Which

Correlating related items using XSLT

落爺英雄遲暮 提交于 2019-12-12 05:26:40
问题 I have the following xml input, <Adult> <Parent> <Id>1</Id> <Name>Nick</Name> <Age>32</Age> </Parent> <Parent> <Id>2</Id> <Name>Michael</Name> <Age>35</Age> </Parent> <Information xmlns="http://ws.apache.org/ns/synapse" xmlns:ns="www.abc.com"> <Children xmlns=""> <Child> <Name>Anne</Name> <Gender>Female</Gender> <ParentId>1</ParentId> </Child> <Child> <Name>Will</Name> <Gender>Male</Gender> <ParentId>1</ParentId> </Child> <Child> <Name>Carney</Name> <Gender>Female</Gender> <ParentId>2<

Grouping based on the node value if only it exists using XSLT 1.0

烂漫一生 提交于 2019-12-12 04:58:32
问题 My requirement is slightly complex one.I have to use only XSLT 1.0. I could able to get the solution using XSLT 2.0, but I need the solution using 1.0. I have the following input xml: <?xml version="1.0" encoding="UTF-8"?> <results> <row> <CASEID>C1</CASEID> <CASEBA>MEDICAID</CASEBA> <ISSUEID>I1</ISSUEID> <ISSUEBA>MEDICAID</ISSUEBA> <OBJECTID>1</OBJECTID> <OBJECTBA>MEDICAID</OBJECTBA> </row> <row> <CASEID>C1</CASEID> <CASEBA>MEDICAID</CASEBA> <ISSUEID>I2</ISSUEID> <ISSUEBA>MEDICAID</ISSUEBA>

Start count at zero instead of one when using xsl:number element

萝らか妹 提交于 2019-12-12 04:46:41
问题 EDIT: I think I found a way around this issue while still using XSLT 1.0, although very verbose and probably prone to errors. Is there a way to use the <xsl:number> element but start counting at zero instead of one, especially when using level="multiple" ? I'm using XSLT 1.0. Current result: 1.2.2. Subitem_B Expected result: 0.1.1. Subitem_B I tried format="0" but it only outputs the points (i.e. ... Subitem_B ) <xsl:number level="multiple" format="0. "/> Bonus question: I found a way around

Lowercase RSS feeds tag names and attributes with XSLT — keeping namespaces

丶灬走出姿态 提交于 2019-12-12 04:34:15
问题 I have been tasked with processing several RSS feed which are badly managed by a 3rd party. My issue is their capitalisation is very unreliable - for instance, some feeds they use the correct element tags <rss> , <item> and <enclosure url="example.mp3"> etc, but other times they use incorrect <RSS> , <Item> and <Enclosure URL="example.mp3"> case. Needless to say, this makes reading the XML (with PHP5 DOMDocument ) very tricky. I found a rather nice XSLT stylesheet here (by the clearly very

Removing related elements using XSLT 1.0

大城市里の小女人 提交于 2019-12-12 04:25:43
问题 I'm attempting to remove Component elements from the XML below that have File children with the extension "config." I've managed to do this part, but I also need to remove the matching ComponentRef elements that have the same "Id" values as these Components. <Fragment> <DirectoryRef Id="MyWebsite"> <Component Id="Comp1"> <File Source="Web.config" /> </Component> <Component Id="Comp2"> <File Source="Default.aspx" /> </Component> </DirectoryRef> </Fragment> <Fragment> <ComponentGroup Id=

Matching and updating attributes in 2 xmls

送分小仙女□ 提交于 2019-12-12 04:24:09
问题 I am trying to update attribute's value in xml with attribute from another xml by matching attributes in both xmls. xml1: <?xml version="1.0" encoding="utf-8"?> <Products> <Product> <List prodId="123456" sellId=""> </List> </Product> </Products> xml2: <?xml version="1.0" encoding="utf-8"?> <Products> <Product> <info prodId="123456" sellId="121"> <qnty>4</qnty> </info> <info prodId="23456" sellId="890"> <qnty>1</qnty> </info> </Product> </Products> I need to node, in second xml by prodId

XSL Copy Nodes based on Attribute Value (Like Search)

梦想与她 提交于 2019-12-12 04:23:29
问题 I have attached XML file and I want to copy only the node which attribute value is something, In my case AHC_. In each node any attribute has value starting with 'AHC_' copy that node and ignore other nodes. I am trying with following XSL and condition is working but not copying the node.Could you please take a look and suggest? <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="UTF-8" indent="yes"

How can we remove name space in level 1 elements of the xml using xslt

荒凉一梦 提交于 2019-12-12 03:56:19
问题 I have this xml <Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <UserInfo xmlns=""> <name>ss</name> <addr>XXXXXX</addr> </UserInfo> </Request> I want the output xml as <Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <UserInfo> <name>ss</name> <addr>XXXXXX</addr> </UserInfo> </Request> Please help me in xsl.. 回答1: Your input and output are semantically the same, but if you

Calling Java API from XSL throws exception “The URI http://xml.apache.org/xslt/java does not identify an external Java class”

南笙酒味 提交于 2019-12-12 03:49:18
问题 I'm using SAXON processor for xsl file as follows: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"> <xsl:output method="xml"/> <xsl:template name="printjavaDate"> <xsl:variable name="date" select="java:java.util.Date.new()"/> <xsl:value-of select=""/> </xsl:template> But this code isn't working for me. It throws error: javax.xml.transform