xslt

xsl if and xsl foreach where element value is...

hi all, this is my xml: <root> <a> <b> <t>1</t> </b> <b> <t>2</t> </b> </a> </root> i want to ask: thats tell me if any t exist but i want true answer onky if b exsit and he have t=1 tanks ...

Select xsl element based on index that is defined in a param

I want to select an element by index with the indexed number being passed in with a param, the param is being passed in via PHP. Here's what I am trying: //PHP $xslt->setParameter('','player',$player); $xslt->importStylesheet( $XSL ); print $xslt->transformToXML( $data ); //xslt <xsl:param name="player" data-type="number"/> <template...

Using xsl to transform single XML doc to multiple docs

Given the following xml document: <XML> <doc1> </doc1> <doc2> </doc2> <XML> I was hoping to use an xsl transform to generate 2 XML documents: <XML> <doc1> </doc1> <XML> And <XML> </doc2> <doc2> <XML> Is this possible? ...

Can anybody recommend a free xslt tool?

I'm looking for a free xslt debugging tool for Windows. Is anybody using anything worth recommending? Appreciate any advice, thanks. ...

Resolve relative paths when loading XSLT files

I've updated the question below Hello, I need to do a XSL transformation using Apache FOP and I have a code like this one: //Setup FOP Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out); //Setup Transformer Source xsltSrc = new StreamSource(new File(xslPath)); Transformer transformer = tFactory.newTransform...

Test if document is well formed before parsing

I need to analyze a few thousand XML documents to see if some of them contains a certain construct. The problem is that some of the documents doesn't contain well formed XML. The basic idea was to use fn:collection() and search inside nodes returned. But this only works if all documents in the collection are well formed. Is it possible...

Adding schema information to xsl transformation output

Hi When performing an xsl transformation on an xml document, I need to add the following snippet to the xml output: <?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:ResourceForm:-myXSD-2010-08-09T08-39-43" solutionVersion="1.0.0.68" productVersion="14.0.0.0" PIVersion="1.0.0.0" href="http://somewhere.com/ResourceF...

How can I print a single <div> without closing it in XSLT

Basically I need to open a div in one if statement and close it in another. I tried <xsl:value-of select="'<div>'"/> but that failed because < and > aren't allowed in attributes. Any ideas? Cheers ...

Why is that the xsl stylesheet is applied by the browser only when the extension is xml

For Eg. <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="mathml.xsl"?> <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head>...</head> <body> <h1>Example</h1> .... <math xmlns="http://www.w3.org/1998/Math/MathML"&gt; <mi>x</mi><mo>+</mo><mn>3</mn> </math> </body> </html> If the above file is nam...

xslt value-of union priority

Hi all I am trying to set a variable in XSLT 1.0 as follows <xsl:variable name="by" select="Contributors/Contributor[Role='ReMixer']/Name | Attribution" /> The Idea is that if the Remixer Role does not exsit then the variable will take on the value of Attribution, however when testing it always takes on the value Attribution regard...

Breaking nodes into pages in XSLT

Hi, My xml format is given below, <SAMPLEFORM> <SAMPLE ID='1' TYPE='Normal'> <DATA>1</DATA> </SAMPLE> <SAMPLE TYPE='PageSplitter'> <DATA>N/A</DATA> </SAMPLE> <SAMPLE ID='2' TYPE='Normal'> <DATA>1</DATA> </SAMPLE> </SAMPLEFORM> I'm trying to split nodes into sets which contain the attrib...

XPath/XQuery: Select a root node with its attributes without childs

I have an xml: <Customer id=""> <Name /> <Address /> </Customer> I would like to select ONLY a root node with its attributes without its child nodes: <Customer id=""/ > Is such thing possible with XPath? ...

extract cdata using xslt

Below is the xml that has CDATA section <?xml version="1.0" encoding="ISO-8859-1"?> <character> <name> <role>Indiana Jones</role> <actor>Harrison Ford</actor> <part>protagonist</part> <![CDATA[ <film>Indiana Jones and the Kingdom of the Crystal Skull</film>]]> </name> </character> For above xml i need to rip off the CDATA and add ne...

Performance problem with XSLT index having many identical keys

Hi there! I'm using XSLT keys in many contexts. Usually, the keys used are more or less unique with very infrequent duplicate instances. Now I defined a key which has A LOT of instances for some key values. To be precise: I'm processing a 1.7 GigaByte file with 420.000 entries having a @STEREOTYPE attribute. Some of the stereotypes occu...

Recursive Loop XSLT

All, I have the below XSLT <xsl:template name="loop"> <xsl:param name="count" select="1"/> <xsl:if test="$count > 0"> <xsl:text> </xsl:text> <xsl:value-of select="$count"/> <xsl:call-template name="loop"> <xsl:with-param name="count" select="$count - 1"/> </xsl:call-template> </xsl:if> </xsl:template> The way to call it is: ...

xsl to remove comments from all the nodes

hi, I am using xsl script to remove comments from all the portion of the xml. It is actually removing the comments which are in parent node but not from the other interior nodes. [edited] Updating the question. My requirement is to remove all the comments from entire XML document. ...

XSLT variable not working

I have below xsl code but it is not working, could anybody please guide me. <xsl:variable name="indent"> <xsl:if test="@type='Text'"> <xsl:if test="@required='yes'"> <xsl:variable name="indent" select="'return ValidateText(this)'" /> </xsl:if> <asp:TextBox id="{@id}" onkeypress="{$indent}" runat="...

Need an XPath that will check an attribute value of any child, grandchild, or great grandchild, etc.

So given this XML... <?xml version="1.0" encoding="UTF-8"?> <root> <tree dah="false"> <tree dah="false"> <tree dah="false"/> <tree dah="false"/> </tree> <tree dah="false"> <tree dah="true"/> <tree dah="false"/> </tree> </tree> </root> ...I need an ...

How to render asp.net mvc controls in XSLT

I would like to use the asp.net mvc actionlink and form controls in xslt code. How do I go about doing this? is this notpossible to do in xslt? I could not find a solution online. ...

<xsl:if > How to deal with tags like "<Test/>"?

Hi, I'm very new to XSL and I'm having some problems. The XML I'm using has some tags like <Example/>. in my XSL (the output is HTML) I used something like this for tags without data: <xsl:if test="count(ContractNr) > 0"> <td>Nr:</td> <td><xsl:value-of select="ContractNr"/></td> </xsl:if> It works great when there is no t...