xslt

In XSLT/XPath, how do I get the first attribute that doesn't match a specific name?

I have this snippet of XSLT code: <xsl:variable name="key" select="@*[1]"/> But I need it to actually set key to be the first attribute (if it exists) that doesn't have a special name. So both of these nodes would have the same key, and special_attr is ignored if it exists. <MyNode var="1" /> <MyNode special_attr="foo" var="1" /> ...

I need to get a number of a XML node's path to use in a node name after a doing a transformation using XSLT

I've got XML like this: <XML> <dealings> <members> <member path="Swap.1.&apos;stream#1.Schedule&apos;" source="0" type="string">CONTEND</member> <member path="Swap.1.&apos;stream#2.Schedule&apos;" source="0" type="string">CONTEND</member> <member path="Swap.1.&apos;stream#3.Schedule&apos;"...

Two phase processing: Do not output empty tags from phase-1 XSLT 2.0 processing

I have some complex XSLT 2.0 transformations. I'm trying to find out if there is general purpose way to ensure that no empty tags are output. So... conceptually, a final stage of processing that recursively removes all empty tags. I understand this could be done by a separate XSLT that did nothing but filter out empty tags, but I need to...

XSLT dumping junk at the end of my file

Hello, I'm using XSLT to manipulate the data inside of an XML file (I'm taking the guts of one XML file and putting them into a new shell in another XML file). I'm only using some of the data in the first file, and the data from the parts that I don't use is being concatenated to the end of the new file. How do I keep XSLT from doing th...

How to find all empty subtrees in XPath

The overall goal is to remove all empty nodes--including nodes which would be made empty if the child empty nodes were removed. The following: <xsl:template match="*[not(node())]"/> will remove empty nodes, but will leave empty nodes that had only empty nodes in them previously. I think I need an xpath that will match all nodes that a...

Remove special characters from XML via XSLT only for specific tags

Hi everyone, I am having a certian issue with special characters in my XML. Bascially I am splitting up an xml into multiple xmls using Xalan Processor. When splitting the documents up I am using their value of the name tag as the name of the file generated. The problem is that the name contains characters that arent recognized by the ...

Name space in XSLT

Below is the example file <?xml version='1.0' encoding='UTF-8'?> <Document xmlns='urn:iso:std:iso:20022:tech:xsd:pain.002.001.02' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'&gt; <pain.002.001.02> ------------ ------------- ------------- </pain.002.001.02> </Document> Below is the XSLT Transformation code : <xsl:transf...

XSLT - Transform the value of an attribute to a tagname

Hello everybody, I have been looking for a while and I do not understand how I can do something like this: From <computer type="laptop"> .... </computer> To <laptop> .... In fact as you can see I want to transform the value of an attribute to a tagname, I do not even know if it is possible. Thank you ...

Creating Valid XML Against Schema with XSLT

I'm sorting a list of elements based on type, as defined in my schema. I know that XSLT can validate against a given schema, but what I want to do is check to make sure that my operation (a copy in this case) is valid before I do it. Simplified code: Incoming Data: <?xml version="1.0"?> <sch:foo xmlns:sch="http://www.whatever.com/sche...

xsl:character-map to replace special characters

Given an element with a value of: <xml_element>Distrib = SU &amp; Prem &amp;lt;&amp;gt; 0</xml_element> I need to turn '&'amp;lt; '&'amp;gt; into '&'lt; '&'gt; (forgive the tick marks around the ampersands above, I couldn't get it to format right) because a downstream app requires it in this format through...

Concatenate data into one variable

An XML file has data like: <AddtlStsRsnInf>/00000002/Level 2 Reject</AddtlStsRsnInf> <AddtlStsRsnInf>The Transaction Reference Number is</AddtlStsRsnInf> <AddtlStsRsnInf>not unique.</AddtlStsRsnInf> How do you concatenate the data from all the three tags into a variable? Thanks and regards, Kiran ...

XSLT - replace value in one node with the value from it's preceeding sibling

Hi There, I'm trying to write an XSLT transformation which will replace the value in one node with the value of it's preceding sibling. Then return the entire document transformed :) Find the occurrences of <package:packageDownloadLocator>http://myunwantedurl&lt;/package:packageDownloadLocator&gt; and replace with the text value of i...

Using jsTree XML module

I'm confused by jsTree's XML module. I'm using 1.0rc2. Specifically, jsTree converts XML to an HTML list-based tree using XSLT. I couldn't get my XML to render so checked out the source code; looks like the XSL is hard-coded into jsTree's code and one particular line means it will only work if you're root's child elements are called ...

Document Library Name in xsl

I need to grab the document library name in a webpartpages:dataformwebpart I see the document library names in several places. Which one should I grab? HeaderTitle="DocLib_23" DetailLink="/sites/SiteCollection/Project_ABC/SubSite1/DocLib_23/Forms/AllItems.aspx" Title="DocLib_23" How do I create a param in xsl to grab the doc lib name ...

Creating multiple XML files from one vanilla XSLT

I have several different XSLT files that all work on the same original XML file to produce four different XML file outputs. Is it possible to make all these XSLT files into one using vanilla XSLT (that is, not using XALAN or anything that's XSLT-parser specific)? All help is appreciated and thanks in advance! ...

Pagination of text from xml file onto html page.

O.K. so I'm developing a website to feature my fiction writings. I'm putting all of my documents into XML files, pulling and parsing them from the server with PHP and displaying them on the page. You can visit the page here for an example. As implied from the background image, What I would like to do is take the text and split it int...

xsl server variable returns null

xsl server variable URL returns null. I tried all the other server variable and they all returns nulls. Is there anything I need to do (like in IIS or web.config) in order for xsl to show server variables? (i am working on webpart in sharepoint). <ParameterBinding Name="URL" Location="ServerVariable(URL)" DefaultValue=""/> <xsl:param ...

Transform an integer value to a repeated character

When my XSL stylesheets encounters this node: <node attribute="3"/> ...it should transform it into this node: <node attribute="***"/> My template matches the attribute and recreates it, but I don't know how to set the value to: the character '*' repeated as many times as the value of the original attribute. <xsl:template match="no...

XSLT: Adding a node!

How do I encapsulate nodes around my XML blocks using XSLT? For example, I have the following XML file. <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" /> <xs...

How do I change the file that the XSLT template is using in Visual Studio 2010?

I have an XSLT file and the first time I ran it, it asked me for an XML file. How do I get it to let go of that setting and let me choose a new one? ...