xslt

How to allow DTD in XML Documents loaded via XSLT's document(uri) function with XslCompiledTransform (.NET)

When the document(uri) function is used to load another document within the XSLT, where the target document contains a DTD I get an XslTransformException, containing an inner XmlException: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false a...

Biztalk explode in XSLT transformations

I'm receiving XML into BizTalk. One part is element and the value is ids separated by comma <Stores>15,34</Stores> I need to transform this into <Stores> <Store>Store 1</Store> <Store>Store 4</Store> </Stores> What I need to do is to explode the value by comma, take each value and get value from database (15 -> Store 1, 34 ...

Matching only one of many unknown nodes with xpath

Hello. Im trying to match only one of each node with a generic match. Can this be done generic at all? I would have prefered to just match one of each node with the same local-name() <xsl:variable name="xmltree"> <node /> <anothernode /> <node /> <anothernode /> <unknown /> <anothernode /> <node /> <unknown /> </xsl:var...

Construct a href= using XSLT

I want to create this: <a href="domain.com?=USERNAME">Login</a> where USERNAME = in XML so the HTML output is specific to the user currently logged in. Can anyone advise? I know I can use: <xsl:variable name="class" select="a:Subject"/> <p class="{$class}">English</p> To extract a value and use it as a CSS Class but what about u...

XSL to get exactly the same html code as in the XML element

XML/XSL newbie here, so please forgive my ignorance. This is the xml input given to me: <entry> <desc> <p>Lorem ipsum <a href="http://www.google.com"&gt;dolor&lt;/a&gt; sit amet.</p> <p>Lorem <strong>ipsum</strong> dolor sit amet.</p> </desc> </entry> I must write an XSL to get this result: <p>Lorem ipsum <a h...

find the number of occurance of a particular substring in a string in xslt

I am writing a script to find the number of occurrences of a particular substring in a string in XSLT. I think it's taking too much time when I want to traverse it in more than two lakh records. Can anyone help me to point out some changes to make it faster, or some other way to get the number of occurrences? Remember that I am taking a...

XSLT getting last element

Hello, I am trying to find the last element in my xml, which looks like <list> <element name="A" /> <element name="B" > <element name="C" /> <element name="D" > <element name="D" /> <element name="E" /> <element name="F" /> <eleme...

Is it possible to have an optional stylesheet in an xsl-stylesheet processing instruction?

I've applied a stylesheet to an xml document using <?xsl-stylesheet ...>, this works great when the XML is being viewed in my application. But if the xml is exported, I want the XML to still render as plain XML, is it possible to have the stylesheet as optional rather than it producing this error when style is not found: Error loadin...

How to insert &nbsp; in XSLT

How can I insert &nbsp; Into an XSLT stylesheet, I keep getting this error: XML Parsing Error: undefined entity Essentially I want a non breaking space character in the XSLT Template. ...

XSLT How to add Logic

I have the following collection in an XML document: <events> <event> <type>Downloaded</type> <result>Sucess</result> </event> <event> <type>Processed</type> <result>Sucess</result> </event> </events> Now in my XSLT I have a table with a TD - I want the value of this TD to represent the status of the...

XSLT - Adding Elements dynamically

Hello, I've a need to display certain XML content in tabular form (XSL-FO for pdf reports), and not all the columns to displayed are present in source XML. So, I was wondering if there is a way to transform source XML by embedding additional columns based on certain element values, and then process the resulting XML to display content?...

XSLT string subsitutions

In XSLT 2.0, is there an easy way to replace named placeholders in a string? I'm thinking of something like Python's string.Template, where you can do this: d = dict(name='Joe', age='50') print Template("My name is $name and my age is $age").substitute(d) The point is to externalize the string, so it can be easily changed. The only w...

HTML output via an XSL transform involving special characters

I am having trouble transforming particular characters from an XML feed into XHTML. I am using the following example to demonstrate the problem. Here is my XML file: <?xml version="1.0" encoding="UTF-8"?> <paragraph>some text including the –, ã and ’ characters</paragraph> Here is the XSLT I am applying: <?xml version="1.0" encodin...

How to stop unwanted whitespace appearing in output following Xslt transformation

I'm using VS2008 to write and test an xsl transformation. The output contains unwanted white space as illustrated by this simplified example: Input: <?xml version="1.0" encoding="utf-8" ?> <envelope> <header> <head id="1" text="Heading1"/> </header> <body> <message> <items> <item id="1" Color="Red"/> ...

xslt to operate on element value before displaying?

The default behavior of the xsl on the right-hand side of http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&amp;xsltfile=cdcatalog is to display a 2-column table with the title and artist of each CD in the XML on the left-hand side. (This is shown by the default output under "Your Result" at the bottom.) I want to modify the ...

template based on element attribute with different namespaces

I am looking for a match on template to process the XML, my XML file looks like <root xmlns="urn:nampespace1" xmlns:xsi="urn:namespace2"> <time xsi:type="IVL"> <low value="19990101"/> <high value="20000223"/> </time> <obs> <time xsi:type="PIVL"> <period value="9" unit="h"/> </time> </obs> </root> ...

XSLT - remove whitespace from template

I am using XML to store a small contact list and trying to write a XSL template that will transform it into a CSV file. The problem I am having is with whitespace in the output. The output: Friend, John, Smith, Home, 123 test, Sebastopol, California, 12345, Home 1-800-123-4567, Personal [email protected]...

XML/XSL to HTML table

Can someone help me get the value of the columndefinition/column/cssclass from within my rows loop? So, in my xsl, I want to pull in the cssclass for the same column position during my "rows" forloop, and put it into my <td class="PullItFromColumnDefition"> Hopefully this makes sense. Can anyone help me figure this out? Thanks. My XM...

Where can I find static/dynamic code analysis tools for XSLT?

Are there any static or dynamic code analysis tools that analyze XSLT/XSL code? The resources I have been able to find so far are: 1. Oxygen xml editor 2. http://gandhimukul.tripod.com/xslt/xslquality.html which looks faily basic in its capabilities ...

Converting legacy SGM to XML

I have a task at work that involves converting legacy SGM files into XML. The SGM files were created using 5 separate high level tags, the new DTD has about 8-12 top level tags that the old ones would need to be mapped to. There are some common tags between the 2 DTDs but there are enough differences that it doesn't make sense to just do...