xslt

How to dynamically get value of a row using XSLT

I have to create one table using XSLT and CSS. The table should look like: ID FNAME 1 AA 2 BB My XML is: <students> <studentDetails> <id>1</id> <fname>AA</fname> </studentDetails> <studentDetails> <id>2</id> <fname>BB</fname> </studentDetails> <students> And here my XSLT so far: <xsl:template matc...

Generic solution for resolution of image in SVG

I have an xml file which I need to visualize in a pdf file. I use xslt to do transformations and an svg image in the pdf. The svg will finally draw some information and also display a tiff image, for which the path and the resolution is in the xml file. The problem is that the image can have different resolutions which I need to fit int...

Does anyone know a tool that can generate a DTD or XSD from a XSL

I'm working on an application that uses XSLT to transform XML generated by JSP. At the moment no DTD exists to describe the XML format the XSL expects. Does anyone know of a tool that can generate a DTD from a XSL describing the input the XSL is expecting? Is this even feasible? Result: The accepted answer pointed out that this is in fa...

Parsing XML file through PHP while using XSLT as the main template file.

I have a lots (500ish) xml files from An old ASP and VBscript that was running on an old windows server. The user could click a link to download the requested xml file, or click a link to view how the xml file will look, once its imported into their system... If clicked to view the output, this opened a popup window were the xml filena...

Selecting a default value in a <select> statement in a XSL file

Hi, I have a list of items like how its listed below, and I'm trying to get that option selected by default which has a certain tag within the "listing" tag. <select> <xsl:attribute name="name"><xsl:value-of select="@id"/>_type</xsl:attribute> <option><xsl:attribute name="value"><xsl:if test="listing/Chat"><xsl:attribute name="selecte...

Problems Transforming EntityObject XML with XSLT

I have an XML document that I generate from an Entity Framework object. The generated XML looks like this: REPOSTED FULL XML <Task z:Id="i1" xmlns="http://schemas.datacontract.org/2004/07/MCC.DAL" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"&gt; <EntityKey z:...

XSLT applied to XML doc with xmlns attribute

I'm applying an XSLT stylesheet to the following XML file: <top xmlns="http://www.foo.com/bar"&gt; <elementA /> <elementB /> <contents> <contentitem> <id>3</id> <moretags1 /> <moretags2 /> </contentitem> <contentitem> <id>2</id> ...

Removing Optional Elements from XML when invalid

I have a piece of xml that contains optional non-enumerated elements, so schema validation does not catch invalid values. However, this xml is transformed into a different format after validation and is then handed off to a system that tries to store the information in a database. At this point, some of the values that were optional in...

How to check whether the value of an attribute is not null or if the length of characters in the value of an attribute is greater than 0

s0SelectedSite is an attribute of a class or a column of a table. <xsl:if test="string-length(@s0SelectedSite) &gt; '0'"> <tr> <td width="50%" bgcolor="#C0C0C0"><font size="2"><b>Selected Site:</b></font></td> <td><font size="2">&#160;<xsl:apply-templates select="DBE:Attribute [@name='s0SelectedSite']"/></font></td> </tr> </xsl:i...

How to display table attributes in XSLT?

I have a table s0Test1 attached to a class s0Test. The table has 4-5 attributes. I want to display them in HTML. I used: <xsl:template match="DBE:Object" mode="s0Test"> <table> <tr>Test1</tr> <tr> <td><font size="2">&#160;<xsl:apply-templates select="DBE:Attribute[@name='s0Test1']"/></font></td> </tr> </table> ...

xsl:output directive is ignored?

I have an XML and an appropriate XSL that I need to provide to a Java application. This Java application is expected to generate a HTML page after XSL transformation. This is not my Java application so I do not know which XSL processor it is using internally. The problem is that it completely ignores my xsl:output directive; thus, inste...

xslt playing an mp3 via xml

I have an xml feed and I need to play an mp3 from the feed. I have set up the player <div class="musicplayer"> <div id="musicplayercontainer060251712481gbakw0201569t"></div> <script type="text/javascript"> var flashvars = {file:"music/betty.mp3",as:"0"}; var params = {wmode: "transparent"}; var attributes = {}; swfo...

Using Java to change xml to html

Hello, I am using java code to create a html document. I have an xsl stylesheet and some xml that I want to create the html from. I am using the TransformerFactory method to do this. My problem is that when it creates the html file, when you open it you see a blank page but the code is there. The issue is that when the html is created ...

Can I specify a default namespace in my XSL stylesheet for each element created?

I am using .NET to transform XML from a DataSet to the sitemap format. Here is where I am at right now. As you can see, I create the root element with the correct namespace. I noticed that if I created child nodes, they all got an empty xmls-attribute (<url xmlns="">...</url>), unless I specified the namespace when I create the element i...

How to do the calculation for a date

Defining a template xsl:template match="DBE:Object" mode="TestTable" Delivery Date Latest Possible Order Date xsl:apply-templates - select="DBE:Attribute[@name='DeliveryDate']/DBE:Date/> xsl:apply-templates select="DBE:Attribute[@name='LatestOrderDate']"/> Now i want to calculate "LatestOrderDate" = "DeliveryDate" - 42...

xpath expression to select child node based on parent properties

<module> <component> <section> <ptemplateId root="1.8"/> <entry> <observation> <templateId root="1.24"/> </observation> </entry> </section> </component> <component> <section> <ptemplateId root="1.10"/> <entry> <observation> <templateId root="1.24"/> </observation> ...

copy XML using XSLT into JSON

Hello, I would like to copy XML using XSLT into JSON. The JSON result would look like this: callback( {"xml":" <?xml version="1.0" encoding="UTF-8"?> <root> ... </root> "}) and my XSLT so far: <xsl:template match="/"> <xsl:text>callback( {"xml":"</xsl:text> <xsl:copy-of select="*"/> <xsl:text>"} )</xsl:text> <...

Java XML Transformer, "HTML" method adding <META> tag, do not want

I'm using the built-in Java XML Transformer to serialize an XML document into text. I'm having a problem however when I am outputting in HTML mode. Whenever I insert a head element the built-in transformer decides to insert a META tag with content-type data. I don't want this tag inside my data and I can't seem to find an output paramet...

How to display all the records of a table using xsl?

Suppose a class "test" has an attribute "test1" which itself is a table. "test1" contains some a1, a2, a3 attributes. I need to display all rows based on the value of an attribute"a1" <xsl:template name="rowCounter"> <xsl:param name="N" /> <tr> <xsl:if test=" DBE:Attribute[@name='a1']/ DBE:Object[@Class='test']/ ...

How to read attribute of a parent node from a child node in XSLT

Just want to know how to read an attribute of a parent node from a child node in XSLT. code: <A> <b attr1="xx"> <c> </c> </b> </A> XSLT: <xsl:template match="c"> <xsl:value-of select="attribute of b node"> </xsl:template> ...