Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:50:33+00:00 2026-06-13T22:50:33+00:00

I have a XML produce with MySQL Query Browser. I’m trying to apply a

  • 0

I have a XML produce with MySQL Query Browser.
I’m trying to apply a XSLT to output the result into Word tables. One table for each record.

Here’s a sample of my XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ROOT SYSTEM "Nessus.dtd">
<ROOT>
    <row>
      <field name="Niveau">Critique</field>
      <field name="Name">Apache 2.2 &lt; 2.2.15 Multiple Vulnerabilities</field>
    </row>
    <row>
      <field name="Niveau">Critique</field>
      <field name="VulnName">Microsoft Windows 2000 Unsupported Installation Detection</field>
    </row>
    <row>
      <field name="Niveau">Haute</field>
      <field name="VulnName">CGI Generic SQL Injection</field>
    </row>
</ROOT>

For the XLST I’ve already found out that I need to do a for-each select

<?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" indent="yes"/>
    <xsl:template match="/">
<xsl:for-each select="ROOT/row">
  Niveau : <xsl:value-of select="????"/>
  Name   : <xsl:value-of select="????"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

When I do this loop I see the same number of empty table as there is <row></row> in my file.

But I haven’t found the way to make the right “value-of select=”. I’ve try the following without luck.

<xsl:value-of select="@name"/>
<xsl:value-of select="name"/>
<xsl:value-of select="@row/name"/>
<xsl:value-of select="row/@name"/>
<xsl:value-of select="@ROOT/row/name"/>

And a few other that I can’t remember. Any idea what I need to craft the request to get the value in my resulting file?

I’ve just tried with :

<?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" indent="yes"/>
    <xsl:template match="/">
<xsl:for-each select="ROOT/row">
  Niveau : <xsl:value-of select="field/@Niveau"/>
  Name   : <xsl:value-of select="field/@name"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

And it output this :

NIVEAU :  
NAME   : name

NIVEAU :  
NAME   : Niveau

NIVEAU :  
NAME   : Niveau

I would like this output :

NIVEAU : Critique
NAME   : Apache 2.2 &lt; 2.2.15 Multiple Vulnerabilities

NIVEAU : Critique
NAME   : Microsoft Windows 2000 Unsupported Installation Detection

NIVEAU : Haute
NAME   : CGI Generic SQL Injection

Any help would be appreciated.

Thank you.

UPDATE

Now with this XSLT

<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="2.0">

  <xsl:output method="text"/>

  <xsl:strip-space elements="*"/>

  <xsl:template match="row">
    <xsl:text>NIVEAU : </xsl:text>
    <xsl:value-of select="field[@name = 'Niveau']"/>
    <xsl:text>&#xa;</xsl:text>
    <xsl:text>NAME   : </xsl:text>
    <xsl:value-of select="field[@name = 'Name']"/>
    <xsl:text>&#xa;&#xa;</xsl:text>
  </xsl:template>

</xsl:stylesheet>

I get this output :

<?xml version="1.0"?>
NIVEAU : 
NAME   : Apache 2.2 &lt; 2.2.15 Multiple Vulnerabilities

NIVEAU : Critique
NAME   : Microsoft Windows 2000 Unsupported Installation Detection

NIVEAU : Haute
NAME   : CGI Generic SQL Injection

As you can see the first field is empty. I could honestly live with that and fill it manually but if you see why this is happenning I’d be very happy 🙂

UPDATE

Using <xsl:value-of select="field[@name = 'foo']"/> gave me the value I wanted. I kept the for-each as it was easier to use (for me) inside a MS Word template.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:50:34+00:00Added an answer on June 13, 2026 at 10:50 pm

    This stylesheet will give you exactly your desired output

    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="2.0">
    
      <xsl:output method="text"/>
    
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="row">
        <xsl:text>NIVEAU : </xsl:text>
        <xsl:value-of select="field[@name eq 'Niveau']"/>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>NAME   : </xsl:text>
        <xsl:value-of select="field[@name eq 'VulnName']"/>
        <xsl:text>&#xa;&#xa;</xsl:text>
      </xsl:template>
    
    </xsl:stylesheet>
    

    This is very specific to your input xml and output text, for example any <field> children of <row> other than ‘Niveau’ or ‘VulnName’ will be dropped from your report. A more generic solution could look like this:

    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      version="2.0">
    
      <xsl:output method="text"/>
    
      <xsl:template match="field">
        <xsl:value-of select="concat(upper-case(@name),': ',.)"/>
      </xsl:template>
    
    </xsl:stylesheet>
    

    This solution though doesn’t exactly match the whitespace formatting in your desired output, but it does capture all possible fields.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webservice that produce XML result. I have been working on this
I am using StreamingMarkupBuilder to produce XML and I need to have a tag.
I have a on memory Datatable like this. I want to produce xml file
I have an XML file ( XML file I produce ) which contains information
I have an sql query pulling a few results from different tables, one of
Is is possible to store directly complete XML file into MySQL db and perform
I am trying to produce XML from erlang values and return that XML via
I have to develop one xml feed from mysql database using php code..here i
I have XML like, <items> <item> <products> <product>laptop</product> <product>charger</product> <product>Cam</product> </products> </item> <item> <products>
I have this xml <products> <product> <name>Demo</name> </product> <product> <name>Black Beauty III</name> <description>Beautiful les

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.