My source file looks like this:
<stuff>
<s>
<contents>
<code>503886</code>
<code>602806</code>
</contents>
...
</s>
<p>
<code>344196</code>
<export>true</export>
...
</p>
<!-- more 's' and 'p' tags -->
...
</stuff>
I need to iterate over 's' and choose those - which inside 'contents' tag have a 'co...
I am trying to transform a bit of xml which represents an image gallery into an html table. (it must be done with html and not with css). How do I add the row break </tr><tr> every six or so columns with xsl?
I have this:
<xsl:for-each select="//email/gallery" >
<td><img>
<xsl:attribute name="src">
<xsl:value...
I have an xslt document and I want to output an anchor (a) tag with some attributes who's values depend on other things.. Thus, I use the xsl:attribute tag with a choose/if underneath it (or vice-versa).. So my code looks like this:
<a href="/somepage.html">
<xsl:if test="current_page='this_page'">
<xsl:attribute name='class'>activ...
I want to wrap the children nodes of <foo/> that are not <bar/> or <baz/> with <corge/>.
Note: <bar/> and <baz/> will always be the first child nodes of <foo/>
Converting this:
<root>
<foo>
<bar>bar</bar>
<baz>baz</baz>
<qux>qux</qux>
<grault>grault</grault>
</foo>
<foo>
<bar>bar</bar>
...
I am trying to figure out the best way to perform a nested for-each & sort. For example my XSLT below performs the following:
Selects a node set.
Sorts by Date attribute.
Performs position() to pull 4 nodes.
Now, the next part is what I am trying to figure out. After step 3 I need to sort by the Date attribute again, but thi...
I'm trying to filter an XML file using XPath. The XPath that I'm using is definitely filtering to the data that I want, but I'm just not sure how to filter the file overall.
Here's the sample XML file:
<fields>
<field name='F'>
<field name='0'><value>F.0 stuff</value></field>
<field name='1'><value>F.1 stuff</val...
I am using xslt to transform an xml document to html for use in an email. I need to compare xml elements with another xml element value so that I know what format to give the value. Basically I have an xml structure as such:
<main>
<comparer>1</comparer>
<items>
<item>
<name>blarg</name>
<values...
I have an xml of the following format
<catalog>
<cd>
<title>CD name</title>
</cd>
</catalog>
I can use xslt to get the element value using the following:
<xsl:template match="/">
<xsl:for-each select="catalog/cd">
<xsl:value-of select="title" />
</xsl:for-each>
But, I am trying to figure out the xsl code to read the xml in the ...
This is the XML file:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="LabXSLT.xslt"?>
<orders>
<order>
<customerid>2364</customerid>
<status>pending</status>
<item instock="Y" itemid="SD93">
<name>Flying By Roller Skates</name>
<price>25.00</price>
<qty>25</qt...
I have a very specific problem where I want to be able to extract the default attribute value of an element as illustrated in the example below.
Every item in the input XML contains multiple child name elements, one to represent the primary name, which is the default attribute value (type='main') and another secondary name (type='short'...
I need to convert incoming phone number strings to a standardized format that does not have any non-numeric characters and strips off the leading number if it is 1.
For example:
"+1 (222) 333-4444 x 5555" becomes "22233344445555"
Thanks in advance for your help!
...
In a stylesheet I would like to choose a template based on an attribute in the source xml.
Unfortunately it looks as if one cannot use the mode attribute of apply-templates as this must be a qname literal.
Is there any other similar way to do this?
Example:
source xml:
...
<document type="1">
<item>...</item>
</document>
...
sty...
I have the following xml.
<root query="Smith Antony Blah Jones">
And the following xsl to split the string into different variables.
<xsl:variable name="query">
<xsl:value-of select="substring-before (root/@query, ' ')" />
</xsl:variable>
<xsl:variable name="query1">
<xsl:value-of select="substring-before(substring-after(root/@que...
How can I map the metadata to data. For example I only want LastName and Email from the xml file into the xls file. How can I select LastName and email from xml file and convert that into two column XLS file columns being Lastname and email. Thank you
XML Document
<root>
<metadata>
<item name="Last Name" type="xs:string" le...
Hi, I want to replace the value of href tags in the HTML using XSLT. For example: if the anchor tag is <a href="/dir/file1.htm" />, I want to replace the href value like this: <a href="http://site/dir/file1.htm" />. The point is I want to replace all the relative urls with the absolute values.
I want to do this for all the anchor tags i...
I'm trying to display different information depending on incoming data. If it's an integer, I want to display just the number, if it's a decimal, I want to use 0.00# pattern. Ya, I know, a bit mixed up, but that's the development spec. :>
I have the following XSL for this specific section but I can't see to get past the xsl:when error...
I would like to use Foursquare API XML results and transform them using XSLT to a RSS feed. I was wondering if there's any web site that has that functionality and generates a URL that returns the final transformation.
Something like:
From URL: http://foursquare.com/myapicall + XSLT transformation
I get a new URL: http://transformer/u...
Hello,
After scouring the net for answers, coming up with "almost" solutions... I decided to reduce the problem to a very simple case.
Consider the following XML snippet:
<me:root xmlns:me="http://stackoverflow.com/xml"
xmlns="http://www.w3.org/1999/xhtml">
<me:element>
<p>Some HTML code here.</p>
</me:element>
</...
I was looking into xslt and started testing with the examples on w3schools.
However, when I save the xml and xsl in files and try opening them locally, chrome won't perform the xsl transform. It just shows a blank page.
I have added the <?xml-stylesheet type="text/xsl" href="style.xsl"> tag to the xml document, and firefox renders it a...
I have a bunch of costs in my XML that I am trying to compare against another cost value, to determine which values to display (only ones higher than the comparator). This works when the numbers use the decimal point as the separator but not with numbers using comma as the decimal separator. I could be getting either, depending on the ...