Click here to Skip to main content
16,016,557 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionXML parsing error --> #10; Pin
NJdotnetdev14-Jul-15 2:23
NJdotnetdev14-Jul-15 2:23 
AnswerRe: XML parsing error --> #10; Pin
User 41802545-Aug-15 2:27
User 41802545-Aug-15 2:27 
QuestionNETIQ Product Help needed. Pin
Member 1156144127-Mar-15 10:24
Member 1156144127-Mar-15 10:24 
AnswerRe: NETIQ Product Help needed. Pin
Richard Andrew x6427-Mar-15 14:14
professionalRichard Andrew x6427-Mar-15 14:14 
AnswerRe: NETIQ Product Help needed. Pin
Abhipal Singh19-May-15 5:07
professionalAbhipal Singh19-May-15 5:07 
Questioncopying attribute from one node to other Pin
ramina sen9-Feb-15 0:10
ramina sen9-Feb-15 0:10 
QuestionXSL: how to properly reference to xml field? Pin
Maciej Los16-Nov-14 9:05
mveMaciej Los16-Nov-14 9:05 
AnswerRe: XSL: how to properly reference to xml field? Pin
Richard Deeming17-Nov-14 2:52
mveRichard Deeming17-Nov-14 2:52 
You can't just use the value of an attribute on the node as an indexer into the collection of nodes. You need to specify the attribute name and a comparison operator:

DocumentContent/section[<ins>@name = </ins>'SingleRow1']/row/FieldA

Your current XSL is matching every <section> node, which is why you're getting two blank lines at the start of your <xsl:for-each> block - one for "SingleRow1", and one for "SingleRow2".

XML
<?xml version="1.0" encoding="Windows-1250"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:template match="/">
   <!--<xsl:template match="DocumentContent/section[@name]">-->
    <html>
      <head>
        <!-- <link rel="stylesheet" href="zastyles.css"/> -->
      </head>
      <body>
        <h2>SingleRow1</h2>
        <table border="1px" bgcolor="yellow">
            <tr>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldA"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldB"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldC"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow1']/row/FieldD"/>
                </td>
            </tr>
        </table>
        <br/>
        <h2>SingleRow2</h2>
        <table border="1px" bgcolor="yellow">
            <tr>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldA"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldB"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldC"/>
                </td>
                <td><xsl:value-of select="DocumentContent/section[@name = 'SingleRow2']/row/FieldD"/>
                </td>
            </tr>
        </table>
        <h2>MulitRow1</h2>
        <table border="1px" bgcolor="lightgreen">
            <xsl:for-each select="DocumentContent/section[@name = 'MultiRow1']/row">
            <tr>
                <td><xsl:value-of select="Field1"/>
                </td>
                <td><xsl:value-of select="Field2"/>
                </td>
                <td><xsl:value-of select="Field3"/>
                </td>
                <td><xsl:value-of select="Field4"/>
                </td>
            </tr>
            </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: XSL: how to properly reference to xml field? Pin
Maciej Los17-Nov-14 4:25
mveMaciej Los17-Nov-14 4:25 
QuestionHow to get behavior similar to the obsoleted XmlValidatingReader Pin
John Whitmire30-Oct-14 3:53
professionalJohn Whitmire30-Oct-14 3:53 
AnswerRe: How to get behavior similar to the obsoleted XmlValidatingReader Pin
Gerry Schmitz30-Oct-14 21:21
mveGerry Schmitz30-Oct-14 21:21 
GeneralRe: How to get behavior similar to the obsoleted XmlValidatingReader Pin
John Whitmire3-Nov-14 3:04
professionalJohn Whitmire3-Nov-14 3:04 
SuggestionRe: How to get behavior similar to the obsoleted XmlValidatingReader Pin
John Whitmire6-Nov-14 2:47
professionalJohn Whitmire6-Nov-14 2:47 
QuestionVB.NET creat new XML Pin
Dereak12-Oct-14 17:43
Dereak12-Oct-14 17:43 
AnswerRe: VB.NET creat new XML Pin
User 41802545-Aug-15 2:28
User 41802545-Aug-15 2:28 
QuestionWriting XML from Excel Using VBA Pin
gedkins@deltagl.com30-Sep-14 14:15
gedkins@deltagl.com30-Sep-14 14:15 
AnswerRe: Writing XML from Excel Using VBA Pin
Richard Deeming1-Oct-14 1:45
mveRichard Deeming1-Oct-14 1:45 
Questiondelimiter or tokenizer in xslt Pin
DanielSatheesh27-Aug-14 1:22
DanielSatheesh27-Aug-14 1:22 
AnswerRe: delimiter or tokenizer in xslt Pin
George Jonsson13-Sep-14 23:55
professionalGeorge Jonsson13-Sep-14 23:55 
QuestionMultiple namespaces in xslt Pin
MaryJames7-May-14 22:00
MaryJames7-May-14 22:00 
AnswerRe: Multiple namespaces in xslt Pin
Richard MacCutchan7-May-14 22:24
mveRichard MacCutchan7-May-14 22:24 
GeneralRe: Multiple namespaces in xslt Pin
MaryJames8-May-14 3:16
MaryJames8-May-14 3:16 
GeneralRe: Multiple namespaces in xslt Pin
Richard MacCutchan8-May-14 3:19
mveRichard MacCutchan8-May-14 3:19 
QuestionUse XmlAttributeOverrides, but get an InvalidOperationException nevertheless Pin
Christian Treffler2-Apr-14 8:15
Christian Treffler2-Apr-14 8:15 
AnswerRe: Use XmlAttributeOverrides, but get an InvalidOperationException nevertheless Pin
Bernhard Hiller2-Apr-14 21:24
Bernhard Hiller2-Apr-14 21:24 

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.