xslt

Modify attribute of certain XML elements

I would like to modify an attribute of a very long xml like this: <element index="0"> <subelement bla="asdf" /> <subelement bla="asdf" /> </element> <element index="1"> <subelement bla="asdf" /> <subelement bla="asdf" /> </element> ... I need to add N the value of each index attribute. Say N=5. The result would be: <e...

XSD Date or no date validation

The following seems to work for MM-YYYY format but I now have a case where it can either be blank or have a date. Is this possible or should I push to only include the attribute in the XML if there is a date and make the attribute optional? <xs:attribute name="edition_date" use="required"> <xs:simpleType> <xs:restriction base="A...

Recursive XML through XSLT to XML

Essentially, I have XML structured like this: <A> <B> <1>data</1> <2>data</2> <C> <1>data</1> <2>data</2> <B> <1>data</1> <2>data</2> <C> <B> <1>data</1> <2>data</2> </B> </C> </B> <B> <1>data</1> <2>data</2> </B> </C> </B> </A> I am trying to get the output to ...

Emphasized text in docbook, fo, pdf out put.

I am trying to emphasize a character of some static text to render into the footer of my pdf, but can't figure out the right combination of tags in my xsl. How can I accomplish this? Example: <!-- Footer content --> <xsl:template name="footer.content"> <xsl:param name="pageclass" select="''"/> <xsl:param name="sequence" select="...

xsl - multiple xsl:if with the same condition

Newbie question on xslt. I've multiple xsl:if checks like <xsl:if test="node/node1"> ...</xsl:if> ... <xsl:if test="node/node1"> ...</xsl:if> ... <xsl:if test="node/node1"> ... </xsl:if> Is there a way to parameterize the test condition to make the code more readable and easy to maintain? Maybe with a variable or something like <xsl:...

Nodes set of the same type with if-test. Make it less.

How to make the code more beautiful (compact)? <xsl:template match="part"> <table class="part"> <xsl:if test="name != ''"> <tr> <td>Название</td><td><xsl:value-of select="name"/></td> </tr> </xsl:if> <xsl:if test="model != ''"> <tr> <td>Модел...

Get URL of XML page from within XSL

How do I get the URL of the XML page from within the XSL, if it is not defined in the XML? ...

How to replace text defined in a given tag or element using xslt, xslt string replace

Hi All, Please help me with this xslt transformation. Source Xml <xml> <test>This is a <bold>sample</bold> description. Please help me with a sample</text> </xml> Expected Output: This is a sample description. Please help me with a sample I just need to make bold only the specified text by the xml markup. Thank you ...

create child nodes from sibling nodes until a different sibbling occurs.

Hi does anyone know what the xsl would look like to transform this XML. There can be N nte's after pid and N nte's after pv1. The structure is guaranteed in that all nte that follows pid belongs to pid and all nte following pv1 belongs to pv1. From: <pid> </pid> <nte> <nte-1>1</nte-1> <nte-3>Note 1</nte-1> </nte> <nte></nte> <pv1>...

How to force javax xslt transformer to encode national characters using utf-8 and not html entities?

I'm working on filter that should transform an output with some stylesheet. Important sections of code looks like this: PrintWriter out = response.getWriter(); ... StringReader sr = new StringReader(content); Source xmlSource = new StreamSource(sr, requestSystemId); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transforme...

How to decode a html string using xslt

I am trying to style an rss feed using xslt. I want to display an image that is stored in the tag on the feed. The problem is it is encoded to display as text on the page instead of being rendered. The following is an example of part of the string. 1). <description>&lt;img src="http&amp;#58;&amp;#47;&amp;#47;buavhw.blu.livefilestore.co...

how can i put in label a value from the xml

i want a label in my xsl which it's value be one from the xml, how can i do that? ...

How do I get a less than in a javascript for loop in XSL to work?

I am using CDATA to escape the script but in IE8's debugger I still get this message: "Expected ')'" in the for loop conditions. I am assuming it still thinks that the ; in the &lt; generated by CDATA is ending the loop conditions. Original script in my XSL template: <script type="text/javascript" language="javascript"> <![CDATA[ ...

How to sort by hexadecimals in xslt?

Hi, im trying to sort my transformed output by a element which contains a hex value. <xsl:sort select="Generation/Sirio/Code" data-type="number"/> Values are plain old Hex: 00 01 02 ... 0A ... FF but they are getting sorted like that: 0A FF 00 01 02, which indicates that the sorting method fails as soon as there are character involved...

xslt apply-templates in second level

I cannot wrap <panel> tags to second level individual items as shown in Expected result bellow. Instead I get all 1.x element values into a single node with the xslt i have written bellow. Please help me. Source xml <root> <step id="1"> <content> <text> 1.0 Sample first level step text ...

error message The URI does not identify an external Java class

Hi! I am new to XSL, and thus new to using scripts within the XSL. I have taken example code (also using C#) and adapted it for my own use.. but it does not work. EDIT: This code works in Visual Studio.. The error is only generated in Oxygen... I am still wanting to have it error free in Oxygen, so any insight is appreciated! The err...

xml to xsl transformation

Hi, I have a requirement to extract the uniquie values from the different nodes of the given xml using xsl transformation. XML FILE:- <?xml version="1.0"?> <docdef version="4.0" styleset="1195000082"> <arg name="CommJob" type="Th_1235000130*_CommJob" required="True" /> <arg name="AddresseePersonInformation" type="...

XSL: How to print an iterated node in for-each

xml: <skills> <skill>PHP</skill> <skill>CSS</skill> <skill>HTML</skill> <skill>XML</skill> </skills> XSL: <ul> <xsl:for-each select="skills/skill"> <li><xsl:value-of select="[what should be xpath here]" /></li </xsl:for-each> </ul> Here what should be the xpath to print each skill? ...

How to style HTML compatible tags in XSL definition using extenal CSS?

I am following w3c schools to learn XSLT. in An example. In-line styling is performed here. How can I link an external (CSS) style sheet to style HTML compliant tags? ...

how can i put an html text in a label at xsl?

in the xml i have a tag with html text, i want do display this html with the xsl. the html tag is htmlInfo. i tought i can put this in a label(in the xsl), but it doesnt work. what can i do? ...