There must be a generic way to transform some hierachical XML such as:
<element1 A="AValue" B="BValue">
<element2 C="DValue" D="CValue">
<element3 E="EValue1" F="FValue1"/>
<element3 E="EValue2" F="FValue2"/>
</element2>
...
</element1>
into the flattened XML (html) picking up selected attributes along the way and...
I'm writing some xlst file which I want to use under linux and Windows.
In this file I use node-set function which declared in different namespaces for MSXML and xsltproc ("urn:schemas-microsoft-com:xslt" and "http://exslt.org/common" respectively). Is there any platform independent way of using node-set?
...
How to get a counter inside xsl:for-each loop that would reflect the number of current element processed.
For example my source XML is
<books>
<book>
<title>The Unbearable Lightness of Being </title>
</book>
<book>
<title>Narcissus and Goldmund</title>
</book>
<book>
<title>Choke</title>
</book>
</...
I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this.
...
I need to get the value of the 'test' attribute in the xsl:when tag, and the 'name' attribute in the xsl:call-template tag. This xpath gets me pretty close:
..../xsl:template/xsl:choose/xsl:when
But that just returns the 'when' elements, not the exact attribute values I need.
Here is a snippet of my XML:
<xsl:template match="fie...
Are there any tools that can tell me what percentage of a XSL document get actually executed during tests?
UPDATE
I could not find anything better than Oxygen's XSL debugger and profiler, so I'm accepting Mladen's answer.
...
The following javascript supposes to read the popular tags from an XML file and applies the XSL Stylesheet and output to the browser as HTML.
function ShowPopularTags()
{
xml=XMLDocLoad("http://localhost/xml/tags/popular.xml?s=94987898");
xsl=XMLDocLoad("http://localhost/xml/xsl/popular-tags.xsl");
if (window.ActiveXObject...
Within an XSLT document, is it possible to loop over a set of files in the current directory?
I have a situation where I have a directory full of xml files that need some analysis done to generate a report. I have my stylesheet operating on a single document fine, but I'd like to extend that without going to another tool to merge the x...
Below is part of the XML which I am processing with PHP's XSLTProcessor:
<result>
<uf x="20" y="0"/>
<uf x="22" y="22"/>
<uf x="4" y="3"/>
<uf x="15" y="15"/>
</result>
I need to know how many "uf" nodes exist where x = y.
In the above example, that would be 2.
I've tried looping and incrementing some var, but I can'...
Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the lizard and pig elements.
<pets>
<cat>
<foo>don't care about this</foo>
</cat>
<dog>
<foo>not this one either...
There are a couple of different .NET XSLT functions that I see used in the out of the box SharePoint web parts (RSS Viewer and Data View web part).
<xsl:stylesheet
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
...>
...
...
Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?
...
I have an xml file like
<ns0:Employees xmlns:ns0="http://TestIndexMap.Employees">
<Employee FirstName="FirstName_0" LastName="LastName_1" dept="dept_2" empNumber="1">
<Schedules>
<Schedule Date_join="2008-01-20" Date_end="2008-01-30" />
</Schedules>
</Employee>
<Employee FirstName="FirstName_0" LastName="LastNam...
In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input started to contain namespaces.
How can I read in this string and allow namespaces?
I've incl...
Imagine I have the folling XML file:
<a>before<b>middle</b>after</a>
I want to convert it into something like this:
<a>beforemiddleafter</a>
In other words I want to get all the child nodes of a certain node, and move them to the parent node in order. This is like doing this command: "mv ./directory/* .", but for xml nodes.
I'd like...
Question
Using XSLT 1.0, given a string with arbitrary characters how can I get back a string that meets the following rules.
First character must be one of these: a-z, A-Z, colon, or underscore
All other characters must be any of those above or 0-9, period, or hyphen
If any character does not meet the above rules, replace it with an ...
I need to create Documentation for a tool (Manually written User Documentation, no Developer/API Documentation from the Source Files). Now, there are about a billion different ways to do it, but I have the following requirements:
Needs to be a physical file, so that it can go to SVN
Needs to be printable
Needs to be readable and search...
I have a string in a node and I'd like to split the string on '?' and return the last item in the array.
For example, in the block below:
<a>
<xsl:attribute name="href">
/newpage.aspx?<xsl:value-of select="someNode"/>
</xsl:attribute>
Link text
</a>
I'd like to split the someNode value.
Edit:
Here's the VB.Net t...
Is there an XSLT library that is pure Python?
Installing libxml2+libxslt or any similar C libraries is a problem on some of the platforms I need to support.
I really only need basic XSLT support, and speed is not a major issue.
...
I have a xsl file that is grabbing variables from xml and they seem to not be able to see each other. I know it is a scope issue, I just do not know what I am doing wrong.
<xsl:template match="one">
<xsl:variable name="varOne" select="@count" />
</xsl:template>
<xsl:template match="two">
<xsl:if test="$varOne = 'Y'">
<xsl:value-...