I need to display certain data in a tabular form, and would prefer to use multi-pass
xslt using node-set() so that I can avoid deploying additional tools (like xsltproc).
Right now, I'm able to perform the required task in two steps i.e.
Step 1: convert XML-1 to XMl-2 using identity template (xsl:copy, using xsl:element to
add dynamic e...
I am having this below variable
<xsl:variable name="testvar">
d
e
d
</xsl:variable>
and I have this function:
<xsl:choose>
<xsl:when test="not($str-input)">
<func:result select="false()"/>
</xsl:when>
<xsl:otherwise>
<func:resul...
I have some XSL on a page with a URL of:
site.domain.com/dir/dir/dir/dir
The same XSL also appears on a page with URL of:
site.domain.com/dir/dir/dir
I need links from these two pages to point to:
site.domain.com/dir/dir/site
So on both pages I need to get: site.domain.com/dir/dir as part of the HREF attribute.
Can anyone th...
I saw string-length on this website
http://www.xsltfunctions.com/xsl/fn%5Fstring-length.html
I think it's the xslt 2.0 syntax.
though, in xslt 1.0, i tried this:
<xsl:template match="/">
<xsl:value-of select="string-length(())" />
</xsl:template>
and i got an error. is there any function that i can use to convert () and pass i...
I got a xml file that contains hierarchical data. Now I need to get some of that data into a php array. I use xsl to get the data I want formatted as a php array. But when I print it it leaves all the tabs and extra spaces and line breaks etc which I need to get rid of to turn it into a flat string (I suppose!) and then convert that stri...
I have a fairly simple layout required.
<ul>
<li>Link</li>
</li>Link</li>
</ul
<ul>
<li>Link</link>
<li>Link</link>
</ul>
However I get:
<ul>
<li>Link</li>
</ul>
<ul>
</li>Link</li>
</ul
<ul>
<li>Link</link>
</ul>
<ul>
<li>Link</link>
</ul>
Im sorry I dont have the XSL to hand, network issues but thought id ask an...
I want to sort nodes base on attributes. Say there are three attributes A, B and C in element E1. I know that a sub-group of nodes have the same value of attribute A and B. How can I get this sub-group retrieve the node that has the max value of C? The tricky part here is that I don't know what value of A is. I just know that sub-group s...
Hello,
I have an attribute whose value is the XPath to the current node, like so:
<xsl:attribute name="path">
<xsl:for-each select="ancestor-or-self::*">
<xsl:if test="name() != 'root'">
<xsl:value-of select="name()">
<xsl:if test="not(position()=last())">
<xsl:text>/</xsl:text>
</xsl:if>
...
Hi there,
I have the following block of code that gets the name of the nodes down the tree, like this:
section/page/subPage
But I would like to be able to get it down to the following (just making it up):
section[@id='someId']/page/subPage[@user='UserA']/@title
I found the following code from one of these StackOverflow posts:
<xsl...
I'm learning XSLT via "Beginning XSLT 2.0 From Novice to Professional". Following the source code from the book, I've tried to compile this in Visual Studio 2008 TS:
<xsl:template match="Program">
<div>
<p>
<xsl:if test="@flag">
<img src="{if (@flag = 'favorite') then 'favorite' else 'interest'}.gif"
al...
In an existing XSL stylesheet I was passing a string into a named template. Due to a requirements change, I now need to display four strings, the string I was displaying and its three siblings. Rather than pass the four separate strings into the named template, I'm trying to pass their parent element (PETrailingFund in the code below),
...
I have a document with a few sections and each section can be very varied as its very dynamic. The requirement is that each section if started on a particular page say for e.g. section 1 appears on page 1 and section 2 starts on this page below section 1 should appear on the same page if it can fit completely else it needs to go onto the...
I am creating a left trim template and I have this below template:
<xsl:template name="str:left-trim">
<xsl:param name="string" select="''"/>
<xsl:variable name="tmp" select="substring($string, 1, 1)"/>
<xsl:if test="$tmp = ' '">
<xsl:variable name="tmp2" select="substring-after($string, $tmp)"/>
<xsl:choose...
I have a list of news items, sorted by dateCreated. I have a preview box control where I only want to show the first item. How can I do that using XSLT?
<xml>
<news>
<newsitem>
<dateCreated>2009-09-09</dateCreated>
<summary>Something great happened</sumamry>
</newsitem>
<newsitem>
...
In XSL 2.0, I'm trying to iterate through some data by the distinct values, and then do something with them.
<xsl:for-each select="distinct-values(InvoiceLine/Service/ServiceMnemonicCode)">
<xsl:variable name="mnemonic">
<xsl:value-of select="."/>
</xsl:variable>
<fo:table-row>
<fo:table-cell>
<fo:block>
...
I want to display an RSS feed from Feedburner on my website, however I'd like to be able to apply an XSLT to it as well.
Is it possible to fetch a URL in an XSLT rather than add the link to the style in the XML?
...
Can anyone tell me how to select the URL from this:
<media:content url="http://feedproxy.google.com/~r/TEDTalks_video/~5/aZWq6PY05YE/TimBrown_2009G.mp4" fileSize="57985745" type="video/mp4" />
I want to:
Create a link to this file:
Trim the URL from:
http://feedproxy.google.com/~r/TEDTalks%5Fvideo/~5/aZWq6PY05YE/TimBrown%5F2009G...
I keep getting "Unknow Error occurred" when i try this in my XSLT:
<table class="TEDtalks">
<xsl:for-each select="/rss/channel/item">
<tr>
<td><xsl:value-of select="title"/></td>
<td>
<xsl:value-of select="media:content/@url" />
</td>
</tr>
</xsl:for-each>
</table>
The XML
<rss>
<channel>
<item>
<title>TEDTa...
I need to get just the filename from this url:
http://feedproxy.google.com/~r/TEDTalks_video/~5/XT8k_DqlzGc/KarenArmstrong_2009G.mp4
SO i need to get:
KarenArmstrong_2009G
I need the filename so i can add .jpg to it and another base url.
...
I need to write generic xsl that would take in an xml document and output the count of nodes and their names. So if I have a file like the following:
<assets>
<asset>
<type>hardware</type>
<item>
<name>HP laptop</name>
<value>799</value>
</item>
<item>
<name>ser...