Using this source document:
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Element1 id="UniqueId1">
<SubElement1/>
<SubElement2>
<LeafElement1/>
<LeafElement1/>
</SubElement2>
</Element1>
<Element2 id="UniqueId2" AttributeToCheck="true">
<SubElement1>
<LeafElement1/>
<LeafElement1/>
</Su...
Using XSL I am trying to turn this XML:
<book><title>This is a <b>great</b> book</title></book>
into this XML:
<book>This is a <bold>great</bold> book</book>
using this xsl:
<xsl:for-each select="book/title/*">
<xsl:choose>
<xsl:when test="name() = 'b'">
<bold>
<xsl:value-of select="text()"/>
</bold>
</xsl:...
I have a question about XSL transformation. Lets take an example (in srcML) which represents a typedef enum in C:
<typedef>typedef <type><enum>enum <name>SomeEnum</name>
<block>{
<expr><name>Value0</name> = 0</expr>,
<expr><name>Value1</name> = <name>SOMECONST</name></expr>,
<expr><name>Value2</name> = <name>SOMECONST</name> + 1</exp...
Hi,
I've got an xml which shoule be transformed using XSLT but there are "." in the Tag and
in cause of that it doesn't work. But the . is allowed in XML-Tags.
Can anybody give me a hint on transforming such a file:
XML:
<root.element>
<test.element>Hello World</test.element>
</root.element>
XSLT:
<xsl:template match="/">
<tes...
Hi,
Basically the thing I would like to achieve is to produce a form with some check boxes which will have their texts, default values from an xml file. As an example the block below should result 3 checkboxes (Use Sword, Use Shield, Use Spell) with the default values assigned. And when that form is posted back I can read them on the co...
I have a SOAP web service that is defined contract-first--the request and response xml are defined by xsds that use a number of different namespaces, and there are 100s of elements defined in xsds. However the web service calls a legacy layer which does not use namespaces in the xml. Therefore I have a transformation layer between the we...
I have some XSLT that looks like:
<xsl:choose>
<xsl:when test="string(//User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])">
<xsl:variable name="Type" select="concat('Documenter', //User[@UserID = $UserID]/ROOT/Prop[@Nm = 'GreaseBoardCategory'])"/>
</xsl:when>
<xsl:otherwise>
...
Hi folks,
is there a XPath function, which returns the absolute path of an element, so I can use it in sth. like:
<xsl:if test="path() = /root/parent/child">
...
</xsl:if>
Thanks.
...
Hello,
Does anyone know how to copy only the first n nodes in a xml file and delete the rest using xslt? So say I only want to copy the first 10 nodes and delete the rest of the nodes that belong to the same parent.
Thanks in advance!
...
The following code works but is messy and slow. I am transforming an XDocument to another XDocument using XSLT2 with Saxon, adapted using SaxonWrapper:
public static XDocument HSRTransform(XDocument source)
{
System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream xslfile = thisEx...
I'm using the following to match all <section>s with a revision attribute set. <section>can appear at many different levels of the document tree, always contained within <chapter>s.
<xsl:for-each select="//section[@revision]">
<!-- Do one thing if this is the first section
matched in this chapter -->
<!-- Do somethi...
I am trying to learn xslt
but have no good tutorials where i can find all info together
please help me here...
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute namespace="{namespace-uri()}" name="{name()}"/>...
Hi,
I am having trouble using the XSLT 1.0 function library (since .NET/Visual Studio doesn't support 2.0), replacing attribute strings using XSLT in my XML document.
The attributes contain URL strings, but as soon as the URLs are read in via the translate() function, everything is garbled and comes out a mess. This is most likely due...
I'm writing a simple asp page to show a team rota based on some XML. Here's the XML:
<rota>
<shift date="20091201" primary="Chan" secondary="John" notes="notes"></shift>
<shift date="20091202" primary="Mike" secondary="Alex" notes="notes"></shift>
<shift date="20091203" primary="Ross" secondary="Mike" notes="notes"></shift>
<shift date=...
Hello All
Im trying to transform an XML document into XHTML using XSL transformation and was wondering how i can choose an XML element given the value of its attribute. e.g.
<image size="small">http:example.small.jpg</image>
<image size="medium">http:example.medium.jpg</image>
<image size="large">http:example.largw.jpg</image>
I only...
My problem:
I have a wealth of atom RSS feed files which have many different atom entries in them and a few overlapping entries between files. I need to find and return an entry based on a URL from any one of the RSS feeds.
Technologies:
This code is being run through PHP 5.2.10's XLSTProcessor extension, which uses XSLT 1, has support ...
Hi,
I have the following working 100% correctly.
However to satisfy my curiosity... is there a way to achieve the same without declaring the currentID variable?
Is there some way to reference it from within the Xpath "test" condition?
The xpath query in the condition must refer to 2 @id attributes to see if they match.
the 'current...
Ok, I've seen numerous variations on this question, but none exactly answer what I'm trying to solve and perhaps I'm just too dense to see how to apply one of the other answers to what I'm trying to do.
I have some XML that looks something like the following:
<?xml version="1.0" encoding="utf-8"?>
<message>
<cmd id="api_info">
<a...
Hi,
I am creating an XML document from my C# code. I need to add the XSL reference in my XML document. My code is:
XmlDocument xDoc = new XmlDocument();
if (!File.Exists(fileName))
{
XmlDeclaration dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
xDoc.AppendChild(dec);
**[Need to add code to add the XSL reference e.g....
I have this XML data and try and make a sum of it using the XSLT snippet below.
Xml
<?xml version="1.0" encoding="utf-8"?>
<values>
<value>159.14</value>
<value>-2572.50</value>
<value>-2572.50</value>
<value>2572.50</value>
<value>2572.50</value>
<value>-159.14</value>
</values>
Xslt
<?xml version="1.0" en...