xslt

i want to adding "xmlns" attribute in xml file using xslt

I want to following xml file output: <?xml version="1.0" encoding="ISO-8859-1" ?> - <T0020 xsi:schemaLocation="http://www.safersys.org/namespaces/T0020V1 T0020V1.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.safersys.org/namespaces/T0020V1"&gt; - <INTERFACE> <NAME>SAFER</NAME> <VERSION>04.02</VERSION...

XSL Output Text

<xsl:for-each select="$all_events[g:active = true()][g:body/g:current = true()]"> <xsl:for-each select="g:body"> <h2 class="normal"><xsl:value-of select="g:sub_title" /></h2> <xsl:for-each select="g:paragraphs"> <xsl:text><xsl:value-of select="g:paragraph" /></xsl:text> ...

XSLT boolean value

I tried searching for my issue on here and was unsuccessful. <xsl:for-each select="$all_events[g:active = 1]"> <xsl:sort select="g:event_date" order="descending"/> <xsl:variable name="fileName"><xsl:value-of select="fn:replaceAll(string(@alf:file_name), '.xml', '.html')"/></xsl:variable> <xsl:variable name="fileU...

Increment a value in XSLT

I'm reasonably new to xlst and am confused as to whether there is any way to store a value and change it later, for example incrementing a variable in a loop. I'm a bit baffled by not being able to change the value of a after it's set doesn't make sense to me, making it more of a constant. For example I want to do something like this...

XSLT transformation with dynamic namespace

Hello everybody, I need to transform an XML file to another XML file, where the source file has a dynamic namespace set to xmlns="whatever". My XSLT runs fine without the namespace being in the file, but I get no output with the namespace. How can I cause the schema of the source file to be applied to the destination file? All help is ...

XSLT is converting my hex attributes to something else, how do I stop it?

I'm trying to transform one xml file to output another xml file, and I need the attribute "account" to be output identically to how it appears below. I have a bunch of these values in the file, most are not working. For values of account like 0x0406 it is output as 0.0.06. But for values like 0x002d it leaves them alone and they come t...

XSLT multiple nodes same name same level.

I have the following XML document: <ReportParameters SP="prRptActivityDetail"> <Parameter> <Name>Period Start Date</Name> <Type>Date</Type> <Control>DateTextbox</Control> <ControlName>dtePeriodStartDate</ControlName> <Validators> <Validator>Required</Validator> <Validat...

Include a XML in XSLT and then apply a foreach

Hello, I have a website coded with XML+XSLT that outputs me a full HTML website. Now, to make the site more dinamic I want to split some parts of the document: the header, footer and sidebar. I was looking at Google and I found this solution: <xsl:param name="doc" select="document('menu.xml')"/> <xsl:template match="/"> <html><head></h...

XSL show attribute name

So, using that <xsl:for-each select="./@*"> [<xsl:value-of/><xsl:value-of select="."/>] </xsl:for-each> I can iterate over attribute values. But I want to see attribute names too. I want see a table: attr1 - val1 attr2 - val2 attr3 - val3 ... Thanks for help! ...

Using a remote stylesheet that includes other stylesheets with relative paths

I'd like to do an XSL transform on a DocBook document using lxml.etree.XSLT. Although the documentation mentions that etree.XSLT() takes a first parameter of xslt_input, I can't seem to find any docs on what this parameter is meant to be. Passing it a file that is open for reading seems to work; passing it a filename in a string does n...

Doing an XSL transform of a branch of a Docbook element tree

I'd like to use the docbook XSL stylesheets to render various parts of a document, without transforming the entire thing. The complication is that some of these parts have <footnoteref> elements whose linkend attributes are not located within the same chunk. In other words, I want to process a branch of the tree which includes the <foo...

which is more prefered to be called, "XSL file" or "XSLT file" ?

What should I call my file containing XSL code (XSLT code??), which one sounds more sensible/meaningful. I know the abbreviation of both of them. But don't know which one to use and where .. edit 1: I just now came across these words in w3schools.com It started with XSL and ended up with XSLT, XPath, and XSL-FO. and also saw...

what is the reason behind XSLT parser's this behavior ?

Hi I had performed a transformation which drops a tag if it is null. I wanted to check whether my transformation is working fine, so instead of checking it manually, I wrote one more XSLT code which just checks the presence of that particular tag in the OUTPUT XML, if it is null, then the second XSLT should output a text "FOUND". (I don...

Append header and footer if they don't exist with XSLT

How can I have XSLT wrap input XML within a parent node, only if it doesn't already exist? For example, if my input is: <Project>...</Project> I want to wrap it with a prefix and a suffix: <?xml version "1.0" encoding="utf-8"> <Site> <Project>...</Project> </Site> If however, <Project> is not the root node of the input, I'd like...

Umbraco.Library.IsLoggedOn() does not work from XSLT

Hello guys, This is simple xslt, that shows the login status of the current user. Everything worked fine on development server, but once we've setup app on production, umbraco.librarty.IsLoggedOn() started always to return false. Application uses method umbraco.libraty.IsLoggedOn() from .NET code and from there it returns proper value,...

what is current() in predicate of predicate

Hello, another XPath/XSL question :) If i have a node tree like: A -- B (anymal-types=pets) ---- C (type=bird) ---- C (type=cat) ---- C (type=dog) -- B (working-animals) ---- C (type=cow) ---- C (type=elephant) -A ... and another xml file ($xmlFile) that lists types that one needs for the...

Name of iteration variable in xsl:for-each on xsl:key in XSLT 1.0

I have XSLT 1.0 code like this: <xsl:key name="enemyItems" match="metadata[attributes/metadata_key/@value = 'enemylist']" use="attributes/metadata_refkey/@value"/> <xsl:template match="item"> <xsl:variable name="enemyList" select="key('enemyItems', @key)/attributes/@value"/> <xsl:if test="str...

XSLT 2.0 How to change default formatting for numbers?

In XSLT 1.0 (using Xalan), outputting the result of: <xsl:variable name="source0" select="number(num3)"/> <xsl:value-of select="$source0"/> was the number spelled out as 2011234. But in XSLT 2.0 (using Saxon), it shows up as 2.011234E6. I want it to always display as 2011234 in the Saxon/2.0 case. Is there a way to set the default pi...

XPath query for GPX files with namespaces?

I am able to access the<trkpt></trkpt>nodes by the xpath expression<xsl:for-each select='gpx/trk/trkseg/trkpt'> when the GPX file has the following simple structure: <gpx> <trk> <trkseg> <trkpt lat="50.5324906" lon="7.0842605"> <ele>105.8824463</ele> <time>2010-07-11T08:50:16Z</time> </trkpt> <trk...

SharePoint Designer Keeps turning &#xa; within source code into literal new line.

I am using an if statement that tests the amount of lines in a cell. <xsl:if test="string-length(@Example) - string-length(translate(@Example, '&#xa;', '')) &lt; 10"> When I type in this code and hit save, that code turns into this: <xsl:if test="string-length(@Example) - string-length(translate(@Example, ' ', '')) &lt; 10"> Instea...