Click here to Skip to main content
15,888,461 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionXpath problem Pin
snehasish9-Jul-10 0:27
snehasish9-Jul-10 0:27 
AnswerRe: Xpath problem Pin
Stuart Dootson9-Jul-10 11:12
professionalStuart Dootson9-Jul-10 11:12 
QuestionExcel to XML conversion Pin
priyaahh5-Jul-10 18:49
priyaahh5-Jul-10 18:49 
AnswerRe: Excel to XML conversion Pin
evd4610-Aug-10 20:13
evd4610-Aug-10 20:13 
Questionxsl:apply-templates help please! [modified] Pin
Neophyte301-Jul-10 4:49
Neophyte301-Jul-10 4:49 
AnswerRe: xsl:apply-templates help please! Pin
Neophyte305-Jul-10 0:17
Neophyte305-Jul-10 0:17 
GeneralRe: xsl:apply-templates help please! Pin
Stuart Dootson6-Jul-10 4:37
professionalStuart Dootson6-Jul-10 4:37 
AnswerRe: xsl:apply-templates help please! Pin
Stuart Dootson6-Jul-10 4:14
professionalStuart Dootson6-Jul-10 4:14 
use the 'name()' function to access a node name

The following XSLT should do what you want...

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <xsl:output method="xml"/>
   
   <xsl:template match="/">
      <table>
         <!-- Iterate through all bed types and items -->
         <xsl:apply-templates select="Beds/*/*"/>
      </table>
   </xsl:template>

   <!-- Just process the odd items (1st, 3rd, 5th etc) for each bed type -->
   <xsl:template match="Beds/*/*[(position() mod 2) = 1]">
      <xsl:if test="text() and following-sibling::*[1]/text()">
      <Row>
         <!-- Description is the parent name + this node's name -->
         <Description><xsl:value-of select="concat(name(parent::node()), name())"/></Description>
         <!-- Value is just the next sibling node's text -->
         <Value><xsl:value-of select="following-sibling::*[1]/text()"/></Value>
         <!-- Quantity is this node's text -->
         <Quantity><xsl:value-of select="text()"/></Quantity>
      </Row>
   </xsl:if>
   </xsl:template>
   
   <!-- This template just sucks up the even items -->
   <xsl:template match="*"/>

</xsl:stylesheet>

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

CodeProject MVP for 2010 - who'd'a thunk it!

GeneralRe: xsl:apply-templates help please! Pin
Neophyte306-Jul-10 5:47
Neophyte306-Jul-10 5:47 
GeneralRe: xsl:apply-templates help please! Pin
Stuart Dootson6-Jul-10 14:38
professionalStuart Dootson6-Jul-10 14:38 
QuestionHow to upload an Xml Schema to my ftp server and have Visual Studio provide intellisense for it? Pin
WebMaster1-Jul-10 2:07
WebMaster1-Jul-10 2:07 
AnswerRe: How to upload an Xml Schema to my ftp server and have Visual Studio provide intellisense for it? Pin
Not Active1-Jul-10 2:38
mentorNot Active1-Jul-10 2:38 
GeneralRe: How to upload an Xml Schema to my ftp server and have Visual Studio provide intellisense for it? Pin
WebMaster1-Jul-10 3:11
WebMaster1-Jul-10 3:11 
Questiontransformed cdata content not escaping properly (or atleast the way i want it it) Pin
nyhtal30-Jun-10 19:59
nyhtal30-Jun-10 19:59 
QuestionVXML Pin
muka6629-Jun-10 4:15
muka6629-Jun-10 4:15 
QuestionHow to create xmpp client using C#? Pin
manjeeet17-Jun-10 23:13
manjeeet17-Jun-10 23:13 
Answercross-post Pin
Luc Pattyn18-Jun-10 2:27
sitebuilderLuc Pattyn18-Jun-10 2:27 
QuestionError in running ASP.NET C# (MySql) site Pin
Dot-Net-Dev16-Jun-10 17:24
Dot-Net-Dev16-Jun-10 17:24 
QuestionBeginner help to tag Bold text in DocBook v5 for XML export [modified] Pin
keeta116-Jun-10 12:06
keeta116-Jun-10 12:06 
QuestionWrite XSL for this xml i want to convert xml to CSV formt Pin
ksanju100012-Jun-10 9:14
ksanju100012-Jun-10 9:14 
AnswerRe: Write XSL for this xml i want to convert xml to CSV formt Pin
SeMartens15-Jun-10 21:10
SeMartens15-Jun-10 21:10 
Questionwriting to xml file Pin
Farraj8-Jun-10 17:17
Farraj8-Jun-10 17:17 
AnswerRe: writing to xml file Pin
Stuart Dootson9-Jun-10 2:13
professionalStuart Dootson9-Jun-10 2:13 
GeneralRe: writing to xml file Pin
Farraj9-Jun-10 4:39
Farraj9-Jun-10 4:39 
AnswerRe: writing to xml file Pin
Estys9-Jun-10 5:22
Estys9-Jun-10 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.