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 1004369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:07:24+00:00 2026-05-16T08:07:24+00:00

Never coded for XML before, totally lost with the various primers which all tell

  • 0

Never coded for XML before, totally lost with the various primers which all tell me to do something different. Which probably means you can do it different ways, but they all show single node situations and this isn’t.

I’ve tried various ways to pick out the WebDisplayPeriod but im convinced im not actually targetting the attribute of that one right. Would love someone to give me a push in the right direction please. also any readable primers on more advanced use of XSLT would be appreciated as w3schools is rubbish 😉 .

I’ve got the following xml

<?xml version="1.0" encoding="UTF-8"?>
<nr:RTPPMDataMsgV1 owner="Network Rail" timestamp="2010-08-05T10:27:04.0Z" classification="public" xsi:schemaLocation="http://xml.networkrail.co.uk/ns/2007/NR rtppm_messaging_v1.17.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msg="http://xml.networkrail.co.uk/ns/2007/EAI" xmlns:nr="http://xml.networkrail.co.uk/ns/2007/NR">
 <msg:Sender application="RTPPM3" organisation="String"/>
  <msg:Publication>
  <msg:TopicID>RTPPM3/InternalPPM</msg:TopicID>
 </msg:Publication>
 <nr:RTPPMData snapshotTStamp="2010-08-05T10:27:02.0Z">
  <nr:SystemMsg/>
  <nr:RAGThresholds type="TOC" medium="87" good="92"/>
  <nr:RAGThresholds type="FOC" medium="70" good="80"/>
  <nr:RAGThresholds type="PPT" medium="85" good="91"/>
  <nr:WebPPMLink>http://connect/Performance/PPM/PPMGuide.doc x</nr:WebPPMLink>
   <nr:PPT rag="G" ragDisplayFlag="Y">93</nr:PPT>
 <nr:NationalPage WebDisplayPeriod="60">
  <nr:WebFixedMsg1>^&lt;5 mins; *&lt;10 mins</nr:WebFixedMsg1>
    <nr:WebFixedMsg2>The Public Performance Measure shows the performance of trains against the timetable, measured as the percentage of trains arriving at destination &apos;on time&apos;. </nr:WebFixedMsg2>
    <nr:WebMsgOfMoment>EC: 1S02 train defect at Balne.</nr:WebMsgOfMoment>
    <nr:StaleFlag>N</nr:StaleFlag>
    <nr:NationalPPM>
    <nr:Total>5079</nr:Total>
    <nr:OnTime>4842</nr:OnTime>
    <nr:Late>237</nr:Late>
    <nr:CancelVeryLate>47</nr:CancelVeryLate>
    <nr:PPM rag="G" ragDisplayFlag="N">95</nr:PPM>
    <nr:RollingPPM trendInd="-" rag="G">94</nr:RollingPPM>
  </nr:NationalPPM>
......

it goes on and on. but the bit im interested in is in the section above.

I’m using the following XSLT to turn it into a legible webpage:

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xsi:schemaLocation="http://xml.networkrail.co.uk/ns/2007/NR rtppm_messaging_v1.6.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msg="http://xml.networkrail.co.uk/ns/2007/EAI" xmlns:nr="http://xml.networkrail.co.uk/ns/2007/NR"  >
<xsl:output method="html" omit-xml-declaration="yes" indent="yes" />

<xsl:param name="mode">TOCPage</xsl:param>
<xsl:param name="location">internal-connect</xsl:param>
<xsl:param name="table1Count">11</xsl:param>
<xsl:param name="table2Count">23</xsl:param>

    <!-- Root template--> 
    <xsl:template match="/nr:RTPPMDataMsgV1/nr:RTPPMData">
        <xsl:element name="{nr:NationalPage}">
            <xsl:attribute name="{WebDisplayPeriod}" >
                <xsl:value-of select="."/>
            </xsl:attribute>
         </xsl:element>
 <html>
<head>
<meta http-equiv="content-type" CONTENT="text/css" />
<meta http-equiv="expires" CONTENT="-1" />
<meta http-equiv="pragma" CONTENT="no-cache" />
<meta http-equiv="cache-control" CONTENT="no-cache" />
<meta http-equiv="refresh" name="refresh" content="{$WebDisplayPeriod}" />
 <title>EC RTPPM Feed</title>
 <link rel="stylesheet" type="text/css" href="stylesheet.css" />
 <link rel="stylesheet" type="text/css" href="xslstylesheet.css" />
</head>

<body>
<p>Hello</p>
      <p>Hello</p>
</body>
</html>
</xsl:template >
</xsl:stylesheet>

and as youve guessed, it never picks up the WebDisplayPeriod.

  • 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-05-16T08:07:25+00:00Added an answer on May 16, 2026 at 8:07 am

    Try it something like this:

    <xsl:template match="/nr:RTPPMDataMsgV1/nr:RTPPMData">
      <xsl:variable name="WebDisplayPeriod" select="./nr:NationalPage/@WebDisplayPeriod" />
    
     <html>
    <head>
    <meta http-equiv="content-type" CONTENT="text/css" />
    <meta http-equiv="expires" CONTENT="-1" />
    <meta http-equiv="pragma" CONTENT="no-cache" />
    <meta http-equiv="cache-control" CONTENT="no-cache" />
    <meta http-equiv="refresh" name="refresh" content="{$WebDisplayPeriod}" />
     <title>EC RTPPM Feed</title>
     <link rel="stylesheet" type="text/css" href="stylesheet.css" />
     <link rel="stylesheet" type="text/css" href="xslstylesheet.css" />
    </head>
    
    <body>
    <p>Hello</p>
          <p>Hello</p>
    </body>
    </html>
    </xsl:template >
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is really baffling me. I've never used XML before, so I'm just playing
My C# is a bit rusty and I've never written XML with it before.
So I've never used XSLT before, so this is probably a very simple problem.
I asked something similar to this before and never got an answer, here's a
Let me start by saying that I've never coded in Python. I need to
I have never used Try-catch in my code before, but now I need to
I've never written Ajax before and I am currently trying to code up an
I have never seen this before. I have a simple custom view that has
I am working with JQuery dialog which is opened before an ajax call and
i have XML files which contain records with the following structure: <xml> <payment contractType=1>

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.