xslt

How to get position of parent element - XSL

What I wish I could do in xsl is the following, but unfortunatly parent/position() is not valid. XSL <xsl:template match="li"> <bullet> <xsl:apply-templates/> </bullet> <!-- if this is the last bullet AND there are no more "p" tags, output footer --> <xsl:if test="count(ancestor::div/*) = parent/position()"> <footer/> ...

flush XML tags having certain value

Hello all I have a webservice that returns an XML like this: <?xml version="1.0" encoding="UTF-8"?> <contractInformation> <contract> <idContract type="int">87191827</idContract> <region type="varchar">null</region> <dueDate type="varchar">null</dueDate> <contactName type="varchar">John Smith</...

Is there a way to seek a specific location in an xml by knowing the index relative to the text nodes in java?

I have a xml document. I know the index where i need to insert the new node. The index that i have is the position considering only the text nodes and ignoring the element tags. Is there a java api to seek the index in a xml knowing the position relative to the text nodes alone and insert a new node in that position? ...

Changing One Tag Name in an XML File Using XSLT

Is it possible for me to have a conditional in XSLT such that I find and replace only the FIRST tag of a particular tag name? For example, I have an XML file with many <title> tags. I would like to replace the first of these tags with <PageTitle>. The rest should be left alone. How would I do this in my transform? What I currently have ...

Exclude first child with XSL-T

Hello, What I'm trying to do is fairly simple, but I can't find the way to. I just want to iterate over the children of a node excluding the first child. For instance, in this XML snippet, I would want all the <bar> elements, except the first one: <foo> <Bar>Example</Bar> <Bar>This is an example</Bar> <Bar>Another example<...

Accessing Extension Objects

I've added an object to the XsltArgumentList. I was wondering how I could access and display it in my transformation? xslarg.AddExtensionObject("someKey", "someValue"); However, when I transform, I wan't to be able to display "someValue". Any idea how? Thanks. ...

xsl:include template with no default namespace causes xmlns=""

Hi, I've got a problem with xsl:include and default namespaces which is causing the final xml document contain nodes with the xmlns="" In this synario I have 1 source document which is Plain Old XML and doesn't have a namespace: <?xml version="1.0" encoding="UTF-8"?> <SourceDoc> <Description>Hello I'm the source description</Descr...

XSL and Namespaces

This may be a really simple question, but its one I can't seem to get and am tearing my hair out over. I have the following XML: <?xml-stylesheet type="text/xsl" href="email.xsl"?> <Example xmlns=""> <Name xmlns="urn:rnb.fulfilment.bus.contracts.public.exampleBookName.v1">Mark</Name> </Example> And am trying to use the following XSL...

Store web content in XML using wiki markup

Does anyone have an XML style sheet that'll convert wiki-like markup to HTML? Or is that a bad idea? I only found one style sheet that'll convert HTML to wiki-like markup, view-source:http://mozile.mozdev.org/0.8/demos/html2wiki.xsl . Or is this a bad idea? Basically, instead of following strict rules with my XML tags to format my conten...

XSLT: a variation on the pagination problem

I must transform some XML data into a paginated list of fields. Here is an example. Input XML: <?xml version="1.0" encoding="UTF-8"?> <data> <books> <book title="t0"/> <book title="t1"/> <book title="t2"/> <book title="t3"/> <book title="t4"/> </books> <library name="my library"/> </d...

XSLT: How to transform partially escaped XML?

I need help transforming an XML file, whose part of it is with escape sequences, into HTML: <?xml-stylesheet type=text/xsl href=XSL_17.xsl?> <Root> <Book> <Author>John smith</Author> <Genre>Novel</Genre> <Details>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Dets&gt;&lt;Ds&gt;&lt;D DN="Pages" DV="381" /&gt;&lt;D DN="Bin...

How to get started with xslt-transformations?

What are good tutorials for that? I mean NOT the ones like "Hi! Today we'll transform <xml>Hello World</xml> to <h1>Hello World<h1>! Good start! Keep learning!" Something like "xlst for 21 days", or "xslt: from novice to professional" :) Thanks, Ilya. ...

Sorting a nodeset before passing to xsl:for-each

I have a situation where loop through a sorted nodeset and apply a template on each of the nodes: <div id="contractscontainer"> <xsl:for-each select="document"> <xsl:sort select="content[@name='ClientName']/text()" /> <xsl:apply-templates select="." mode="client-contract" /> </xsl:for-each> </div> I want to do something sp...

What's the best way to only output a tag if it exists in XSL?

I'm working on an interface with a 3rd party app that basically needs to take XML that was spat out by the app and convert it into XML our system can deal with. It's basically just applying a stylesheet to the original XML to make it looks like "our" XML. I've noticed that in other stylesheets we have, there are constructs like this: ...

Reading multiple instances of a tag or element using XSLT

My RDF xml file is something like this.. <rdf:RDF> <rdf:Description rdf:about="........"> <j.0:property rdf:resource="....."/> <j.0:property rdf:resource=....."/> <j.0:property rdf:resource="........"/> </rdf:Description> </rdf:RDF> Now in my XSLT stylesheet I need to retrieve the values of all the j.0:...

Rendering XML document with multiple languages

I have an XML page with some elements in various languages - Arabic, English, Chinese, Japanese.. Which encoding format should I have to choose for that? If I try to render the XML with an XSL (using utf-8 or ISO-8859-6 or ISO-2022-JP), I get this error: An invalid character was found in text content. How shall or solve this? Th...

XML transform element appearing in wrong place in document

I am having some problems with an XML transform and need some help. The stylesheet should iterate through all suffix elements and place the contents without the suffix tag next to the last text node within its first ancestor quote-block element (see desired ouput). It works when only a single suffix is present, but not when 2 are prese...

XmlSerializer with custom tranform using XSLT

Is there a way to deserialize a XML stream using XmlSerializer by applying a custom tranform defined in a XSLT? ...

Sharepoint xsl ddwrt FormatDateTime issue

I use the ddwrt:FormatDateTime function to format the output like yyyyMMdd. inputs like 01/01/2010 work fine but when the day gets over the number 12 the output is an emtpy string. ddwrt:FormatDate(string(@myDate), 1033, 'yyyyMMdd') At first I thought it could be a language specific problem but even none of those combinations work: 1...

atrribute value using msxml from xml

Hi I have the folowing XML <?xml version="1.0" encoding="ISO-8859-1" ?> - <DEVICEMESSAGES> <VERSION xml="1" checksum="" revision="0" envision="33050000" device="" /> <HEADER id1="0001" id2="0001" content="Nasher[<messageid>]: <!payload>" /> <MESSAGE level="7" parse="1" parsedefvalue="1" tableid="15" id1="24682" id2="24682" eve...