Processing nodes, xml to xlst

After gutting this over and over trying to figure out here is all that is left of my xlst. I am trying to pull the child elements from the xml document and out put them but even with a well formed document I am some how getting a parsing error.

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

      <xsl:output method="text"/>

      <xsl:template match="/">
        <xsl:for-each select="FamousMountains/mountain"/>
        <xsl:value-of select="name[@language='English'] "/>

      </xsl:template>

</xsl:stylesheet>

This is the xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Note: This is a comment-->
<?xml-stylesheet type="text/xsl" href="Asg06.xsl"?>
<FamousMountains>
  <mountain>
    <name language="English">Mount Everest</name>
    <name language="PigLatin">ountMa verestEa</name>
    <location>Nepal</location>
    <height units="feet">29035</height>
  </mountain>
  <mountain>
    <name language="English">Mount Ranier</name>
    <location>Washington</location>
    <height units="feet">14411</height>
  </mountain>
  <mountain>
    <name language="English">Mount St. Helens</name>
    <location>Washington</location>
    <height units="feet">8364</height>
  </mountain>
  <mountain>
    <name language="English">Mount Washington</name>
    <name language="PigLatin">ountMa ashingtonWa</name>
    <location>New Hampshire</location>
    <height units="feet">6288</height>
  </mountain>
  <mountain>
    <name language="English">Mount Bonnell</name>
    <name language="PigLatin">ountMa onnellBa</name>
    <location>Austin</location>
    <height units="feet">800</height>
  </mountain>
  <mountain>
    <name language="English">Mount Vesuvius</name>
    <name language="PigLatin">ountMa esuviusVa</name>
    <location>Italy</location>
    <height units="feet">4203</height>
  </mountain>
  <mountain>
    <name language="English">Mount Etna</name>
    <name language="PigLatin">ountMa tnaEa</name>
    <location>Sicily</location>
    <height units="feet">10922</height>
  </mountain>
</FamousMountains>

This is what the xlst should output:

Put your name here
Famous Mountains of the World

Mountain Name: Mount Everest
Mountain Name: (ountMa verestEa)

Mountain Name: Mount Ranier
Mountain Name: ()

Mountain Name: Mount St. Helens
Mountain Name: ()

Mountain Name: Mount Washington
Mountain Name: (ountMa ashingtonWa)

Mountain Name: Mount Bonnell
Mountain Name: (ountMa onnellBa)

Mountain Name: Mount Vesuvius
Mountain Name: (ountMa esuviusVa)

Mountain Name: Mount Etna
Mountain Name: (ountMa tnaEa)

Any help or insight would be greatly appreciated.

Answers


Just to reiterate what the comments say (@helderdarocha), the <xsl:value-of /> will only work if it's inside the <xsl:for-each /> tags.

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

    <xsl:template match="/">
        <xsl:for-each select="FamousMountains/mountain" >
            <xsl:value-of select="name[@language='English'] "/>
        </xsl:for-each>
    </xsl:template>

</xsl:stylesheet>

Gives

Mount EverestMount RanierMount St. HelensMount WashingtonMount BonnellMount VesuviusMount Etna

This should be enough to get you started! (but here's an answer anyway.)

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

    <xsl:template match="/">Put your name here
Famous Mountains of the World<xsl:apply-templates />
    </xsl:template>

    <xsl:template match="mountain">
Mountain Name: <xsl:value-of select="name[@language='English'] "/>
Mountain Name: (<xsl:value-of select="name[@language='PigLatin'] "/>)</xsl:template>

</xsl:stylesheet>

Need Your Help

How to modify the pager in radgrid

asp.net telerik radgrid

I have a GridView that was changed to a RadGrid, now before the GridView had the paging using a drop down above it with the following options to show items per page

Modbus TCP in Java / Android

java tcp modbus

I am working on a modbus TCP implementation in Java. I've tried 3 different libraries so far modbus4j, jamod, and j2mod. I can successfully access my slave device with the linux modpoll tool: http:...