473,770 Members | 6,713 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

remove

N9
Hi

I had a xslt that parse a XML document, output is HTML

But XSLT adding not valid code:
<ul class="level_1" xmlns="" xmlns:xsi="http ://www.w3.org/2001/
XMLSchema-instance">
I had try to adding the text below to stylesheet but it does't help.

xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" exclude-result-
prefixes="xsi"

do any help me ?

Best regards

//N9
Jun 27 '08 #1
4 1754
N9 wrote:
I had a xslt that parse a XML document, output is HTML

But XSLT adding not valid code:
<ul class="level_1" xmlns="" xmlns:xsi="http ://www.w3.org/2001/
XMLSchema-instance">
Show us the relevant XML input and the stylesheet, then we can help
improve the stylesheet.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #2
N9
Hi

Here is my xslt.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et version="1.0" xmlns:xsl="http ://www.w3.org/1999/XSL/
Transform">
<xsl:output omit-xml-declaration="ye s" encoding="utf-8"
method="html" indent="no"/>

<xsl:variable name="firstMenu ItemClass">firs t </xsl:variable>
<xsl:variable name="lastMenuI temClass">last </xsl:variable>
<xsl:variable name="selectedM enuItemClass">s elected </xsl:variable>
<xsl:variable name="expandedM enuItemClass">e xpanded </xsl:variable>
<xsl:variable name="hasChildr enMenuItemClass ">hasChildr en </
xsl:variable>

<xsl:variable name="FilenameP refix">
<xsl:value-of select="Navigat ion/@FilenamePrefix "/>
</xsl:variable>
<xsl:variable name="FileExten sion">
<xsl:value-of select="Navigat ion/@FileExtension"/>
</xsl:variable>
<xsl:variable name="SelectedP ageId">
<xsl:value-of select="Navigat ion/@PageId"/>
</xsl:variable>
<xsl:template match="Module" xml:space="defa ult">

<xsl:choose>
<xsl:when test="Name='Sit emap'">
<div id="sitemap"><x sl:apply-templates select="Layout" /></div>
</xsl:when>
<xsl:otherwis e>
<xsl:copy-of select="Layout"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="Module">
<xsl:apply-templates select="Layout/Row" />
</xsl:template>
<xsl:template match="Layout/Row">
<xsl:apply-templates select="Cell[@Id='2']"/>
</xsl:template>
<xsl:template match="Cell">
<xsl:copy-of select="Content Area/node()"/>
</xsl:template>
<xsl:template match="ContentA rea"><xsl:copy-of select="node()"/></
xsl:template>
<xsl:template match="Navigati on" xml:space="defa ult">
<xsl:if test="Navigatio nElement[@ShowInNavigati on='true']">
<ul>
<xsl:attribut e name="class"><x sl:text/>level_<xsl:val ue-of
select="number( NavigationEleme nt/@Level)+1" /></xsl:attribute>

<xsl:apply-templates
select="Navigat ionElement[@ShowInNavigati on='true']"/>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="Navigati onElement[@ShowInNavigati on='true']"
xml:space="defa ult">
<xsl:variable name="itemClass ">
<xsl:if test="position( ) = 1">
<xsl:value-of select="$firstM enuItemClass" disable-output-
escaping="yes"/>
</xsl:if>
<xsl:if test="position( ) = last()">
<xsl:value-of select="$lastMe nuItemClass" disable-output-
escaping="yes"/>
</xsl:if>
<xsl:if test="@Selected ='true'">
<xsl:value-of select="$select edMenuItemClass " disable-output-
escaping="yes"/>
</xsl:if>
<xsl:if test="@ChildSel ected='true'">
<xsl:value-of select="$expand edMenuItemClass " disable-output-
escaping="yes"/>
</xsl:if>
<xsl:if test="@NumberOf Children &gt; '0'">
<xsl:value-of select="$hasChi ldrenMenuItemCl ass" disable-
output-escaping="yes"/>
</xsl:if>
</xsl:variable>

<xsl:choose>

<xsl:when test="@PageId=3 39"><li class="fagfolk" >Specielt for
fagfolk</li></xsl:when>

<xsl:when test="@PageId=5 40"><li class="fagfolk" >Specielt for
fagfolk</li></xsl:when>

<xsl:when test="@PageId=8 92"><li class="fagfolk" >Specielt for
fagfolk</li></xsl:when>

<xsl:when test="@PageId=8 93"><li class="fagfolk" >Specielt for
fagfolk</li></xsl:when>
</xsl:choose>

<li>
<xsl:if test="not($item Class='')">
<xsl:attribut e name="class">
<xsl:copy-of select="normali ze-space($itemClas s)"/>
</xsl:attribute>
</xsl:if>
<a>
<xsl:if test="not($item Class='')">
<xsl:attribut e name="class">
<xsl:copy-of select="normali ze-space($itemClas s)"/>
</xsl:attribute>
</xsl:if>
<xsl:attribut e name="href" xml:space="defa ult">
<xsl:choose>
<xsl:when test="LongUrl != ''">/<xsl:value-of
select="LongUrl " disable-output-escaping="yes"/></xsl:when>
<xsl:otherwis e>/<xsl:value-of select="$Filena mePrefix"/
><xsl:value-of select="@PageId "/><xsl:value-of select="$FileEx tension"/
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="Navigat ionTitle" disable-output-
escaping="yes"/>
</a>
<xsl:if test="Navigatio nElement[@ShowInNavigati on='true']">
<ul>
<xsl:attribut e name="class"><x sl:text/>level_<xsl:cop y-of
select="number( NavigationEleme nt/@Level)+1"/></xsl:attribute>

<xsl:apply-templates
select="Navigat ionElement[@ShowInNavigati on='true']"/>
</ul>
</xsl:if>
</li>
</xsl:template>
<xsl:template match="*" />
</xsl:stylesheet>
Jun 27 '08 #3
But XSLT adding not valid code:
<ul class="level_1" xmlns="" xmlns:xsi="http ://www.w3.org/2001/
XMLSchema-instance">
to remove that default).

If the problem is that you're trying to validate against a DTD which
doesn't allow those namespace declarations... well, DTDs are really not
fully compatable with namespaced documents, for just this sort of
reason. You can modify the DTD to allow namespace declarations to appear
anywhere, but since prefixes may change you can't really write a DTD
which will completely cover the possibilities.

Switching to schemas will solve that problem.

Meanwhile. you may be able to reduce the namespace declarations by
avoiding situations such as this one where the default namespace and/or
other prefixes are being redefined in the middle of the document. (The
reason it generated the xmlns= is that you were in a default namespace
context and then tried to output a non-namespaced <ulelement.) It's
also possible to tell XSLT not to output namespaces which aren't being
used, which may help if the xsi: is being copied when you didn't intend
it to be.
Jun 27 '08 #4
N9 wrote:
Here is my xslt.
Show us a minimal but complete XML input document too that allows us to
reproduce the problem.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
55571
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are also removed) So far I have (val is value, ar is array, returns new array):
11
3089
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper class for a primitive int with some methods. I don't show the Integer class because it will not add any information to my problem. Main is using some STL function Now to my problem.
6
4956
by: Arne Claus | last post by:
Hi If've just read, that remove() on a list does not actually remove the elements, but places them at the end of the list (according to TC++STL by Josuttis). It also says, that remove returns a new, logical end pointer, so that the following myList::iterator end = myListObj.remove(myInt); myListObj.erase(end, myListObj.end()); is possible and removes the "invalid" items at the end of the list.
3
3810
by: Don | last post by:
My user control has a combobox with an arraylist attached to it along with custom add and remove methods. The "Add" method is working great. However I don't understand why the "Remove" method isn't working. It neither removes the item from the arraylist nor from the combobox like it's supposed to do. A couple of notes: cbx is the name of the combobox within my usercontrol, file is the name of the arraylist within my usercontrol. To try...
3
5413
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some example first:
6
7197
by: tshad | last post by:
Is there a reason to use session.remove over session.contents.remove? Don't they both remove the key and data from the contents collection? I assume that session(x) = nothing does essentially the same thing but is actually deleted later by the GC. Thanks, Tom
7
6609
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer include them in the set that is displayed to the user) but I don't want to delete the corresponding row from the database. I've tried using the .Rows.Remove() method but an exception is thrown to say I don't have a 'delete' command in the data...
6
6006
by: sam_cit | last post by:
Hi Everyone, I'm using remove() function to delete a file, and i observed the following behavior, Concerned file : sample.txt Operation : i open the file in read mode and don't close the file. remove() returns -1 and the file is not deleted. The above operation is successful when i close the file just before
10
18078
by: =?Utf-8?B?YmJn?= | last post by:
Hi all, I wanted to go through each entry(?) of ArrayList and remove some particular entry. So I tried following but it throws exception at runtime: foreach (myEntry entry in myArrayList) { // do something... if (entry.fieldA == 0)
2
9093
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following code the dynamically adds a specific number of controls. for x as integer = 1 to 10 Dim btn as Windows.Forms.Button = New Windows.Forms.Button btn.Name = "btn" & x btn.Text = "Test" & x controls.add(btn) next x This results in 10 buttons appearing on the screen. I've excluded the
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.