[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Do a copy of a document but avoid duplicates in ce

Subject: RE: Do a copy of a document but avoid duplicates in certain lists of tags
From: "Lenz, Georg" <georg.lenz@xxxxxxx>
Date: Tue, 28 Oct 2003 12:21:38 +0100
georg lenz
Thanks Michael
Case closed.


-----Original Message-----
From: Michael Kay [mailto:mhk@xxxxxxxxx]
Sent: Dienstag, 28. Oktober 2003 11:18
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Do a copy of a document but avoid duplicates in
certain lists of tags


Sorry. This is painful. Let's spell it out.

If you declare a default namespace xmlns="some.uri" in a source XML
document, then an element written as <x> is actually <{some.uri}x>. That
is, its real name consists of both the namespace URI and the local name.

If you want to match such an element, you need to match both the uri and
the local name:

<xsl:template match="some:x" xmlns:some="some.uri">

It does not help to declare a default namespace in the stylesheet,
because the default namespace only applies to element names appearing
literally in the stylesheet (e.g. <x>), it does not apply to names used
within XPath expressions or match patterns.

Michael Kay

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Lenz, Georg
> Sent: 28 October 2003 09:05
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: RE:  Do a copy of a document but avoid 
> duplicates in certain lists of tags
> 
> 
> Hei Michael,
> 
> thanks for the advice.
> 
> I thought put everything in the default name space 
> and everything will workout.
> 
> But if I declare the default name space in the style sheet 
> it still does not work??
> 
> The style sheet:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" 
> xmlns="http://www.w3.org/1999/xhtml" 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
> 	<xsl:output method="xml" version="1.0" encoding="UTF-8" 
> indent="yes"/>
> 	<xsl:template match="node()|@*">
> 		<xsl:copy>
> 			<xsl:apply-templates select="node()|@*"/>
> 		</xsl:copy>
> 	</xsl:template>	
> 	<xsl:template match="ul" >
> 		<xsl:comment>From Here</xsl:comment>
> 		<xsl:copy >
> 			<xsl:for-each 
> select="li[not(.=following-sibling::li)]">
> 				<xsl:copy>
> 					<xsl:apply-templates 
> select="node()|@*"/>
> 				</xsl:copy>
> 			</xsl:for-each>
> 		</xsl:copy>
> 	</xsl:template>
> </xsl:stylesheet>
> 
> does not work on:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <?xml-stylesheet type="text/xsl" 
> href="extractDublicates.xslt"?> <html 
> xmlns="http://www.w3.org/1999/xhtml">
> 	<head>
> 		<title>Enter the title of your XHTML document 
> here</title>
> 	</head>
> 	<body>
> 		<p>Enter the body text of your XHTML document here</p>
> 		<div>
> 			<p>Another chapter</p>
> 			<ul>
> 				<li>A</li>
> 				<li>A</li>
> 				<li>B</li>
> 				<li>B</li>
> 				<li>B</li>
> 				<li>C</li>
> 				<li>C</li>
> 			</ul>
> 		</div>
> 	</body>
> </html>
> 
> ????
> 
> Georg Lenz
> 
> 
> -----Original Message-----
> From: Michael Kay [mailto:mhk@xxxxxxxxx]
> Sent: Dienstag, 28. Oktober 2003 09:18
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Do a copy of a document but avoid 
> duplicates in certain lists of tags
> 
> 
> Precisely, as I suspected: you've put the elements in a 
> namespace and you therefore need to prefix their names in the 
> stylesheet.
> 
> Michael Kay
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> > Lenz, Georg
> > Sent: 28 October 2003 06:44
> > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> > Subject: RE:  Do a copy of a document but avoid 
> > duplicates in certain lists of tags
> > 
> > 
> > Hei Michael,
> > 
> > its the default namespace, the document starts with
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> > <?xml-stylesheet type="text/xsl" 
> > href="extractDublicates.xslt"?> <html 
> > xmlns="http://www.w3.org/1999/xhtml">?
> > 
> > Georg Lenz
> > 
> > 
> > -----Original Message-----
> > From: Michael Kay [mailto:mhk@xxxxxxxxx]
> > Sent: Montag, 27. Oktober 2003 18:57
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  Do a copy of a document but avoid
> > duplicates in certain lists of tags
> > 
> > 
> > Probably the "ul" element is in the XHTML namespace. You need
> > to declare a prefix for this namespace in your stylesheet and 
> > write match="xhtml:ul".
> > 
> > Michael Kay
> > 
> > > -----Original Message-----
> > > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> > > Lenz, Georg
> > > Sent: 27 October 2003 16:15
> > > To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> > > Subject:  Do a copy of a document but avoid duplicates 
> > > in certain lists of tags
> > > 
> > > 
> > > 
> > > 
> > > I have the following problem:
> > > 
> > > I want a perfect copy of an xhtml document but want avoid coping 
> > > duplicates "li"s in all "ul" lists.
> > > 
> > > I tried:
> > > 
> > > 	<xsl:template match="node()|@*">
> > > 		<xsl:copy>
> > > 			<xsl:apply-templates select="node()|@*"/>
> > > 		</xsl:copy>
> > > 	</xsl:template>	
> > > 
> > > 	<xsl:template match="ul" >
> > > 		<xsl:comment>From Here</xsl:comment>
> > > 		<xsl:copy >
> > > 			<xsl:for-each
> > > select="li[not(.=following-sibling::li)]">
> > > 				<xsl:copy>
> > > 					<xsl:apply-templates
> > > select="node()|@*"/>
> > > 				</xsl:copy>
> > > 			</xsl:for-each>
> > > 		</xsl:copy>
> > > 	</xsl:template>
> > > 
> > > but it does not work.
> > > It does not even touch the ul template?
> > > If the document node would be "ul" it works???
> > > 
> > > Any help available.
> > > 
> > > Thanks in advance
> > > 
> > > Mit freundlichem Gruß / Best Regards
> > > Georg Lenz
> > > Java IDE Core
> > > SAP AG
> > > 
> > > Neurottstrasse 16
> > > 69190 Walldorf
> > > T   +49-6227-7-64235
> > > F   +49-6227-7-74235
> > > E   georg.lenz@xxxxxxx
> > > 
> > > 
> > > 
> > >  XSL-List info and archive:
> > http://www.mulberrytech.com/xsl/xsl-list
> > > 
> > 
> > 
> >  XSL-List info
> > and archive:  http://www.mulberrytech.com/xsl/xsl-list
> > 
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> > 
> 
> 
>  XSL-List info 
> and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.