I am using saxon-js and having issues with compiling/viewing in chrome - xslt-2.0

The XSL will compile to the .sef file but in the inspect of firefox I get "Transformation failure: Error XPDY0002 at line #34 Focus for . (dot) is absent".
From my very limited knowledge, this saxon error is from not making a template the main template so why would it be tripped on a for-each?
The XSL file
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ixsl="http://saxonica.com/ns/interactiveXSLT"
xmlns:saxon="http://saxon.sf.net/"
xmlns:js="http://saxonica.com/ns/globalJS"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:map="http://www.w3.org/2005/xpath-functions/map"
xmlns:array="http://www.w3.org/2005/xpath-functions/array"
exclude-result-prefixes="#all"
version="2.0">
<xsl:mode on-no-match="shallow-copy"/>
<xsl:output method="html" encoding="utf-8" indent="yes" />
<xsl:template name="xsl:initial-template" match="/">
<h1 align="center">Pack Schedule</h1>
<table border="3" align="center" >
<tr>
<th>Complete by</th>
<th>How Many Days Past</th>
</tr>
<xsl:for-each select="order/job">
<xsl:sort select="Complete_by"/>
<xsl:variable name="dueDateOP" select="xs:date(Complete_by)"/>
<xsl:variable name="daysOut" select="(current-date() - $dueDateOP)"/>
<xsl:variable name="daysOutDated" select="fn:days-from-duration($daysOut)"/>
<xsl:choose>
<xsl:when test="$daysOutDated >= 14">
<tr bgcolor="red">
<td><xsl:value-of select="Complete_by"/></td>
<td><xsl:value-of select="$daysOutDated" /></td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr bgcolor="yellow">
<td><xsl:value-of select="Complete_by"/></td>
<td><xsl:value-of select="$daysOutDated" /></td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
The XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="pack3.xsl" ?>
<order>
<job>
<Complete_by> 2022-05-17</Complete_by>
<Comments> </Comments>
<Updated> 5/26/2022 10:05:31 AM</Updated>
</job>
<job>
<Complete_by> 2022-05-27</Complete_by>>
<Comments> </Comments>
<Updated> 5/26/2022 10:05:31 AM</Updated>
</job>
<job>
<Complete_by> 2022-05-24</Complete_by>
<Comments> </Comments>
<Updated> 5/26/2022 10:05:31 AM</Updated>
</job>
<job>
<Complete_by> 2022-06-17</Complete_by>
<Comments> </Comments>
<Updated> 5/26/2022 10:05:31 AM</Updated>
</job>
<job>
<Complete_by> 2022-04-17</Complete_by>
<Comments> </Comments>
<Updated> 5/26/2022 10:05:31 AM</Updated>
</job>
</order>
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Days spent</title>
<script type="text/javascript" src="saxon-js/SaxonJS2.rt.js"></script>
<script type="text/javascript">
window.onload = function() {
SaxonJS.transform({
stylesheetLocation: "pack3.sef.json"
}, "async");
}
</script>
<script>console.log(SaxonJS.getProcessorInfo())</script>
</head>
<body id="body">
<h1>There is an error</h1>
</body>
</html>

Related

How to access variable defined under for-each loop/If condition in another for each loop

I have to generate the output in sequence and so I wanted to know how to access the variable defined under For-each loop/If condition and then value of select inside another for loop.
As per my example how to access partn and date3? Please help and suggest.
what is the concept for achieving the same..I have tried with-param as well, but didn't work for me.
XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="myfunc"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fn="http://www.w3.org/2005/xpath-functions" >
<xsl:output method="text" encoding="utf-8" />
<xsl:output omit-xml-declaration="yes" />
<xsl:param name="break" select="'
'" />
<xsl:template match="ZGS/ID">
<xsl:for-each select="E1">
<xsl:if test="PA = 'CE'">
<xsl:variable name="partn" select="PAN"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="E13">
<xsl:if test="ID = 033">
<xsl:variable name="date3"
select="substring(DAT,3,8)"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="E1E">
<xsl:text>823</xsl:text>
<xsl:text>03</xsl:text>
<xsl:for-each select="E1ED">
<xsl:if test="QU = 012 ">
<xsl:value-of select="BEL"/>
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$partn"/>
<xsl:value-of select="$date3"/>
</xsl:for-each>
</xsl:template>
INPUT:
<?xml version='1.0' encoding='utf-8'?>
<ZGS>
<ID BEGIN="1">
<E1 SEGMENT="1">
<PA>AG</PA>
<NAME>ABC</NAME>
<SP>E</SP>
<AND>0004</AND>
</E1>
<E1 SEGMENT="1">
<PA>RE</PA>
<PAN>IUIOP</PAN>
<NAME>ABC1</NAME>
<SP>EQ</SP>
<AND>0005</AND>
<EKA3 SEGMENT="1">
<QU>009</QU>
</EKA3>
</E1>
<E1 SEGMENT="1">
<PA>CE</PA>
<PAN>PODW</PAN>
<NAME>ABC2</NAME>
<SP>EP</SP>
<AND>0006</AND>
</E1>
<E13 SEGMENT="1">
<ID>001</ID>
<DAT>20190329</DAT>
</E13>
<E13 SEGMENT="1">
<ID>002</ID>
<DAT>20190429</DAT>
</E13>
<E13 SEGMENT="1">
<IDD>033</IDD>
<DAT>20190529</DAT>
</E13>
<E1E>
<E1ED>
</E1ED>
<E1ED>
</E1ED>
</E1E>
In XSLT, variables once declared/defined, they cannot be changed. And exists only in the loop they are defined.
You might not need the xsl:for-each loop here. Instead the variables can be globally defined, so that you can use them where you want in your xslt.
You can try the following:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="myfunc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
<xsl:output method="text" encoding="utf-8" />
<xsl:output omit-xml-declaration="yes" />
<xsl:param name="break" select="'
'" />
<xsl:variable name="partn" select="/ZGS/ID/E1[PA = 'CE']/PAN" />
<xsl:variable name="date3" select="substring(/ZGS/ID/E13[ID = '033']/DAT,3,8)" />
<xsl:template match="ZGS/ID">
<xsl:for-each select="E1E">
<xsl:text>823</xsl:text>
<xsl:text>03</xsl:text>
<xsl:for-each select="E1ED">
<xsl:if test="QU = 012 ">
<xsl:value-of select="BEL" />
</xsl:if>
</xsl:for-each>
<xsl:value-of select="$partn" />
<xsl:value-of select="$date3" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/jyRYYiu
Using xsl:param, it can be achieved as
<xsl:param name="partn" select="/ZGS/ID/E1[PA = 'CE']/PAN" />
<xsl:param name="date3" select="substring(/ZGS/ID/E13[ID = '033']/DAT,3,8)" />
<xsl:template match="ZGS/ID">
<xsl:for-each select="E1E">
<xsl:text>823</xsl:text>
<xsl:text>03</xsl:text>
<xsl:for-each select="E1ED">
<xsl:if test="QU = 012 ">
<xsl:value-of select="BEL" />
</xsl:if>
</xsl:for-each>
<xsl:for-each select="$partn">
<xsl:value-of select="." />
</xsl:for-each>
<xsl:value-of select="$date3" />
</xsl:for-each>
</xsl:template>
https://xsltfiddle.liberty-development.net/jyRYYiu/1

Copy matching elements under one group element

I have a flat xml and I need to copy all matching elements under one element.
In input xml there are title elements which can randomly appear in xml. I want to put them under one element. Any help?
Input:
<root>
<element>
<para>Text 11.</para>
<para>Text 22.</para>
</element>
<title number="1">
<title.block>Title1</title.block>
<para>Text 33.</para>
<para>Text 44.</para>
</title>
<title number="2">
<title.block>Title2</title.block>
</title>
<element1>
<para>Some Text</para>
</element1>
<title number="3">
<title.block>Title2</title.block>
<para>Text 55.</para>
</title>
<result>
<para>Some Text</para>
</result>
</root>
desired output is:
<root>
<element>
<para>Text 11.</para>
<para>Text 22.</para>
</element>
<title.group>
<title number="1">
<title.block>Title1</title.block>
<para>Text 33.</para>
<para>Text 44.</para>
</title>
<title number="2">
<title.block>Title2</title.block>
</title>
<title number="3">
<title.block>Title2</title.block>
<para>Text 55.</para>
</title>
</title.group>
<element1>
<para>Some Text</para>
</element1>
<result>
<para>Some Text</para>
</result>
</root>
Simply write a template for the first title that creates the group and copies that title and all following siblings into the group:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="#*|node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="root/title[1]">
<title-group>
<xsl:copy-of select="., following-sibling::title"/>
</title-group>
</xsl:template>
<xsl:template match="root/title[position() gt 1]"/>
</xsl:transform>
http://xsltransform.net/a9Giwu

XSL:KEY Function for external file

I have an issue in key function, key function not running in following code.
my input is
XML (Keys.xml)
<?xml version="1.0" encoding="UTF-8"?>
<Keys>
<Key year="2001" name="ABC"/>
<Key year="2002" name="BCA"/>
</Keys>
XML to convert
<?xml version="1.0" encoding="UTF-8"?>
<p>
<text> .. .. <key>ABC</key> ...</text>
<text> .. .. <key>BCA</key> ...</text>
</p>
XSLT
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<xsl:key name="keydata" match="*[name() = document('keys.xml')]/Keys/Key" use="#name"/>
<xsl:template match="key">
<xsl:copy>
<xsl:attribute name="ref"><xsl:value-of select="key('keydata', .)/#year"/></xsl:attribute>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Output
<p>
<text> .. .. <key ref="">ABC</key> ...</text>
<text> .. .. <key ref="">BCA</key> ...</text>
</p>
Desired Ouput
<p>
<text> .. .. <key ref="2001">ABC</key> ...</text>
<text> .. .. <key ref="2002">BCA</key> ...</text>
</p>
This should work:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:variable name="keys" select="document('keys.xml')" as="document-node()"/>
<xsl:key name="keydata" match="Key" use="#name"/>
<xsl:template match="node()|#*">
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="key">
<xsl:copy>
<xsl:attribute name="ref"><xsl:value-of select="$keys/key('keydata', current())/#year"/></xsl:attribute>
<xsl:value-of select="."/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
In the XSL specification, there's an example entitled "Example: Using Keys to Reference other Documents" that exactly matches your use case.
This is the resulting document:
<?xml version="1.0" encoding="UTF-8"?>
<p>
<text> .. .. <key ref="2001">ABC</key> ...</text>
<text> .. .. <key ref="2002">BCA</key> ...</text>
</p>
Change <xsl:key name="keydata" match="*[name() = document('keys.xml')]/Keys/Key" use="#name"/> to <xsl:key name="keydata" match="Keys/Key" use="#name"/> and then <xsl:attribute name="ref"><xsl:value-of select="key('keydata', .)/#year"/></xsl:attribute> to <xsl:attribute name="ref" select="key('keydata', . doc('Keys.xml'))/#year"/></xsl:attribute>.

How to group and Sum of hrs based on the key value in XSLT

Can you please suggest xslt code on how to get the results based on the below
xml on group by Week value. The expected output should be:
Year Week Tot Hrs Ben Hrs
2015 33 80.7 0
2015 34 120.7 0
Advance thanks for your help
XML:
<?xml version="1.0" encoding="UTF-8"?>
-<wd:Report_Data xmlns:wd="urn:com.workday.report/TLB024_TEST">
-<wd:Report_Entry>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>33</wd:FISCAL_WEEK>
<wd:TOT_HRS>40</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>33</wd:FISCAL_WEEK>
<wd:TOT_HRS>0.07</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>34</wd:FISCAL_WEEK>
<wd:TOT_HRS>40</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>34</wd:FISCAL_WEEK>
<wd:TOT_HRS>0.07</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
</wd:Report_Entry>
-<wd:Report_Entry>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>33</wd:FISCAL_WEEK>
<wd:TOT_HRS>40</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
-<wd:PAYROLL_RESULT_LINE>
<wd:FISCAL_YEAR>2015</wd:FISCAL_YEAR>
<wd:FISCAL_WEEK>34</wd:FISCAL_WEEK>
<wd:TOT_HRS>40</wd:TOT_HRS>
<wd:BEN_HRS>0</wd:BEN_HRS>
</wd:PAYROLL_RESULT_LINE>
</wd:Report_Entry>
-<wd:Report_Entry>
</wd:Report_Data>
XSLT :
This is the xslt code, I tried not able to get the desire result.
<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wd="urn:com.workday.report/TLB024_TEST" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/|*">
<xsl:copy>
<xsl:apply-templates select="*" />
</xsl:copy>
</xsl:template>
<xsl:template match="wd:Report_Entry">
<File xmlns:xtt="urn:com.workday/xtt">
<xsl:for-each select="wd:PAYROLL_RESULT_LINE">
<Record>
<xsl:variable name="Group" select="../wd:PAYROLL_RESULT_LINE[((wd:FISCAL_YEAR=current()/wd:FISCAL_YEAR) and (wd:FISCAL_WEEK=current()/wd:FISCAL_WEEK)]" />
<xsl:if test="generate-id()=generate-id($Group[1])">
<xsl:copy>
<fiscal_year xtt:align="left"><xsl:value-of select="wd:FISCAL_YEAR"/></fiscal_year>
<fiscal_week xtt:align="left"><xsl:value-of select="wd:FISCAL_WEEK"/></fiscal_week>
<tot_hrs xtt:fixedLength="7" xtt:align="left"><xsl:value-of select="format-number(sum($Group/wd:TOT_HRS), '0.##')"/></tot_hrs>
<ben_hrs xtt:fixedLength="7" xtt:align="left"><xsl:value-of select="format-number(sum($Group/wd:BEN_HRS), '0.##')"/></ben_hrs>
<Filler><xsl:text>
</xsl:text></Filler>
</xsl:copy>
</xsl:if>
</Record>
</xsl:for-each>
</File>
</xsl:template>
</xsl:stylesheet>
If you are using XSLT 2.0, this is a very simple grouping problem:
<xsl:for-each-group select="wd:PAYROLL_RESULT_LINE"
group-by="concat(wd:FISCAL_YEAR, '/', wd:FISCAL_WEEK)">
<Record>
<fiscal_year xtt:align="left"><xsl:value-of select="wd:FISCAL_YEAR"/></fiscal_year>
<fiscal_week xtt:align="left"><xsl:value-of select="wd:FISCAL_WEEK"/></fiscal_week>
<tot_hrs xtt:fixedLength="7" xtt:align="left"><xsl:value-of select="format-number(sum(current-group()/wd:TOT_HRS), '0.##')"/></tot_hrs>
<ben_hrs xtt:fixedLength="7" xtt:align="left"><xsl:value-of select="format-number(sum(current-group()/wd:BEN_HRS), '0.##')"/></ben_hrs>
<Filler><xsl:text>
</xsl:text></Filler>
</Record>
</xsl:for-each-group>

How to turn-off showing child items for selected Main Menu items in Umbraco CMS?

In order to explain my issue easier, please first see this photo
On my template I have already configured Top navigation but problem is that I am trying to make new menu Item which will be called 'News' and thing is that I don't want that every out of 99 news items I will publish (in next two months), to be autmatically available as sumbenu child item under 'News'.
As I noticed, most of the configuration is under 'umbTopNavigation.xslt'
]>
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes" />
<xsl:param name="currentPage"/>
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="topNavigation">
<li class="home">
<xsl:if test="$currentPage/#id = $currentPage/ancestor-or-self::* [#level=$level]/#id">
<xsl:attribute name="class">home current</xsl:attribute>
</xsl:if>
Home
</li>
<xsl:for-each select="$currentPage/ancestor-or-self::* [#level=$level]/* [#isDoc and string(umbracoNaviHide) != '1']"> <li>
<xsl:if test="#id = $currentPage/#id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<a class="navigation" href="{umbraco.library:NiceUrl(#id)}">
<span><xsl:value-of select="#nodeName"/></span>
</a> </li>
</xsl:for-each> </ul>
</xsl:template>
but I can't figure out what exactly I need to change?
Any help is appreciated and many thanks in advance!
MC2012
First macro
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="items" select="$currentPage/ancestor-or-self::* [#isDoc and #level = 2]/* [#isDoc and string(umbracoNaviHide) != '1']"/>
<!-- The fun starts here -->
<xsl:if test="count($items) > 0">
<ul>
<xsl:for-each select="$items">
<li>
<a href="{umbraco.library:NiceUrl(#id)}">
<xsl:value-of select="#nodeName"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Second Macro
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="umbraco.library"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<!-- Specify level of the top node for a language (usually 1) -->
<xsl:variable name="level" select="1" />
<!-- Grab the top node -->
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[#level = $level]" />
<xsl:template match="/">
<ul class="menu">
<!-- Create the Home link -->
<li>
<xsl:if test="$currentPage/#id = $siteRoot/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl($siteRoot/#id)}">
<xsl:value-of select="$siteRoot/#nodeName" />
</a>
</li>
<!-- Process all children of $siteRoot (if any) -->
<xsl:apply-templates select="$siteRoot/*[#isDoc][not(umbracoNaviHide = 1)]" />
</ul>
</xsl:template>
<!-- Generic template for all nav links -->
<xsl:template match="*[#isDoc]">
<li>
<xsl:if test="#id = $currentPage/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(#id)}">
<xsl:value-of select="#nodeName" />
</a>
<!-- Render sub menu if necessary -->
<xsl:call-template name="submenu" />
</li>
</xsl:template>
<!-- Template for Inactive links -->
<xsl:template match="*[#isDoc][umbracoNaviInactive = 1]">
<li>
<xsl:if test="#id = $currentPage/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<span>
<xsl:value-of select="#nodeName" />
</span>
<!-- Submenu? -->
<xsl:call-template name="submenu" />
</li>
</xsl:template>
<!-- Template checking for, and processing any submenu -->
<xsl:template name="submenu">
<xsl:variable name="subPages" select="*[#isDoc][not(umbracoNaviHide = 1)]" />
<xsl:if test="$subPages">
<ul>
<xsl:apply-templates select="$subPages" />
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Ok - you have two options. A quick hack or a full solution.
The quick hack is to update the second macro where the subnav is called and exclude the subnav being called where it's the news page (and you can include other pages in here too)
In this example I've used node ID 1107 to be the ID of your news page, but you will need to update this with your actual news page ID.
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="umbraco.library"
>
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:param name="currentPage" />
<!-- Specify level of the top node for a language (usually 1) -->
<xsl:variable name="level" select="1" />
<!-- Grab the top node -->
<xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[#level = $level]" />
<xsl:template match="/">
<ul class="menu">
<!-- Create the Home link -->
<li>
<xsl:if test="$currentPage/#id = $siteRoot/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl($siteRoot/#id)}">
<xsl:value-of select="$siteRoot/#nodeName" />
</a>
</li>
<!-- Process all children of $siteRoot (if any) -->
<xsl:apply-templates select="$siteRoot/*[#isDoc][not(umbracoNaviHide = 1)]" />
</ul>
</xsl:template>
<!-- Generic template for all nav links -->
<xsl:template match="*[#isDoc]">
<li>
<xsl:if test="#id = $currentPage/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<a href="{umbraco.library:NiceUrl(#id)}">
<xsl:value-of select="#nodeName" />
</a>
<!-- Render sub menu if necessary excluding the news pages -->
<xsl:if test="not(#id=1107)">
<xsl:call-template name="submenu" />
</xsl:if>
</li>
</xsl:template>
<!-- Template for Inactive links -->
<xsl:template match="*[#isDoc][umbracoNaviInactive = 1]">
<li>
<xsl:if test="#id = $currentPage/#id">
<xsl:attribute name="class">sel</xsl:attribute>
</xsl:if>
<span>
<xsl:value-of select="#nodeName" />
</span>
<!-- Submenu? -->
<xsl:call-template name="submenu" />
</li>
</xsl:template>
<!-- Template checking for, and processing any submenu -->
<xsl:template name="submenu">
<xsl:variable name="subPages" select="*[#isDoc][not(umbracoNaviHide = 1)]" />
<xsl:if test="$subPages">
<ul>
<xsl:apply-templates select="$subPages" />
</ul>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
The proper way to do it would be to add a property to your document type to include a property to say do not list children or similar, and then test for that in the XSLT, but that's a much more involved fix, and for that I suggest you read up a bit more on how XSLTs work. Let me know if you want to go down that route and there are plenty of resources I can direct you to
thanks,

Resources