xslt

Passing a variable from within XSL:for-each to outside the XSL:for-each

Hello, I'm trying give a variable a value within XSL:for-each and access the variable after the XSL:for-loop has ended (or even after it's moved to the next XSL:for-each). I've tried using both global and local variables but they don't seem to work. Is this possible? If not, is there another way around the problem? -Hammer ...

xsltproc doesn't select elements by name

I am trying to transform XHTML using an XSLT stylesheet, but I can't even get a basic stylesheet to match anything. I'm sure I'm missing something simple. Here's my XHTML source document (no big surprises): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; ...

How to get value of attribute inside an element

I want to get an attribute from another element. E.g. <xsl:template match="tag1"> Test: <xsl:value-of select="inner[@class='test']@name"/> </xsl:template> XML: <xml> <tag1> <inner class="something" name="123"/> <inner class="test" name="456"/> </tag1> </xml> So what I'm expecting is to get Test: 456 Obviously the ...

How to output HTML file from XML and XSLT stylesheet

Hi, I've created a XML data document and an XSLT stylesheet, and I want to output an HTML document based on the two. My stylesheet has the tag, and my XML document has the processor instuction (along with various "xsl:value-of" references). My question is, what are the actual "mechanics" of getting the XSLT processor (which, I understa...

Converting a string as a nodelist in xsl

I currently have a string (XSLT 1.0) which I'd like to turn into a NodeList so that it can be used the following example. ($testString represents an element in a XML tree) <xsl:apply-templates select="$testString"> <xsl:template match="$testString"> I have tried using the following but neither seem to work <xsl:apply-templates sele...

XML query regarding position ()

Possible Duplicates: XSL: List divided into columns. [XSLT]: Rendering a node sequence as M x N table Hi All, I need to print my XML in such a way that, in HTML, each row contains 2 columns. In first column my first value gets printed and in second the second one, then the row gets change and it move on. it will be more cle...

How can XSLT present data in column instead of row

Hi, i Have the following data in XML <data> <record> <id>1</id> <name>David</name> <age>40</age> </record> <record> <id>2</id> <name>Tully</name> <age>38</age> </record> <record> <id>3</id> <name>Solai</name> <age>32</age> </record> <record> <id>4</id> <name>Michael</name> <age>49</ag...

Alphanumeric sort on mixed string value revisited

Note that I posed a very similar question earlier but the requirements have since changed http://stackoverflow.com/questions/3842719/alphanumeric-sort-on-mixed-string-value The primary difference in the requirements now is that the source XML can include forms with all alpha chars in the form_name or all integers. The form_name can be...

How can I wrap a group of adjacent elements using XSLT?

I have some XML with <ListItem> elements, and I'd like to wrap any consecutive runs with <List> elements. So, source XML would look something like this: <Section> <Head>Heading</Head> <Para>Blah</Para> <ListItem>item 1</ListItem> <ListItem>item 2</ListItem> <ListItem>item 3</ListItem> <ListItem>item 4</ListItem> <Para>Some...

What is the difference between <xsl:apply-templates /> and <xsl:apply-templates select="." />

What is the difference between <xsl:apply-templates /> and <xsl:apply-templates select="." />. I thought that the select="." was not necessary, but I am getting different results depending on which I use. Sorry if this is a repeat. I have tried searching this issue but could not find anything. ...

Using Variable and XPATH to select value of element

Hi, I have the following snipset of code <xsl:variable name="cId" value="c001" /> <clients> <c001>Mario</c001> <c002>Luigi</c002> </clients> And Based on variable's value, I need to select the correct element under clients. For Example. variable cId is assigned with value c001. Is there a way for me to select the value of ...

Counters in XSLT

how to implement counter type functionality in xslt ...

How xsl will work when "xmlns" attribute exist in a node of xml.

My xsl is working fine when "xmlns" attribute doesn't exist in a node integration_test_results of xml. What i can do in xsl so it will work when "xmlns" attribute exist in integration_test_results node. Please help me ASAP. Here i am attaching my xml and xsl file: Attach xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?...

XSLT why is &#xA; showing up in my hrefs?

I have the following XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"> <xsl:output method="html" omit-xml-declaration="yes" /> <xsl:strip-space elements="*"/> <xsl:template match="@* | node()"> <xsl:copy...

XSL: Replacing certain characters with xml tags

This one is a bit tricky, and I've been stuck on it for a bit of time. What I wish to do is put tags in place of brackets '[' (e.g. for buttons, links, etc), and in place of ']' <section> <title>Buttons</title> <orderedlist> <listitem> <para>Clicking on [Save] will attempt to save changes, then it navigates...

[XSLT] Position() and Issues with the value I am retrieving

<tableLayout> <tableColumn width="250"/> <tableDivider spaceAfter="0" spaceBefore="0"/> <tableColumn/> <tableDivider spaceAfter="0" spaceBefore="0"/> <tableColumn/> </tableLayout> When selecting the width for the current "column" using the above data (not my decision to structure it like this...

Navigating and sorting XML within xsl:variable using XSLT 2.0

The XML within the 'formslist' variable is created using apply-templates. This snippet is from a 2.0 stylesheet. <xsl:variable name="formlist"> <forms> <FORM form_name="form1" print_seq="1200"/> <FORM form_name="form2" print_seq="1500"/> <FORM form_name="form3" print_seq="9000"/> <FORM form_name="form4" print_se...

Viewing the output of Visual Studio's XSLT debugger

I'm using Visual Studio to debug a transform. If I am viewing the transform and select XML > Start XSLT Debugging, VS automatically opens the output file and as I step through the transform I can observe the output being written. In my case however, because the transform is performed by an application that first sets some parameters, I...

using xml as xsl variable

I have to create slightly dynamic pdf (two variables) with two text blocks in different languages. Most of the text in both blocks is static I was thinking if I could create one template that would create xsl-fo for the layout. Then create two variables containing custom xml. Something like: <xsl:variable name="TEXT_CONTENT_ENG" > ...

XSLT : Cannot convert the operand to 'Result tree fragment'.

Hello, I work on an xslt stylesheet, and I should receive as parameter two additional XML. I get an error when I use the node-set() method (from namespace ms, microsoft). The contents of the XML is correct. The parameters are send with classic ASP. Here's the header and the call in xslt: <?xml version="1.0" encoding="utf-8"?> <xsl:styl...