xsl-list
[Top] [All Lists]

Re: [xsl] Xpath Syntax Issue

2012-06-23 21:39:04
I still wasn't getting the results in my application, so I created
pets.xml and sure enough the template worked. It only works with my
original document if I remove attributes found in the root element.

The original first 6 lines:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="
            http://www.sitemaps.org/schemas/sitemap/0.9
            http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd";>

I had to remove all attributes from <urlset> before the XSL would
work. Do I need to reference the schema in my XSL?

Thanks everyone for the help.

Nathan

On Sat, Jun 23, 2012 at 5:05 PM, G. Ken Holman
<gkholman(_at_)cranesoftwrights(_dot_)com> wrote:
At 2012-06-23 16:40 -0400, John A. Walsh wrote:

This seems to work:

<xsl:template match="pets/animal[species[normalize-space(.) = 'fish']]"/>


Which would be the same as:

 <xsl:template match="pets/animal[normalize-space(species) = 'fish']"/>

... which might be easier for someone maintaining the stylesheet to
understand.

Of course the processor may optimize both expressions to be the same
executing code, but from a maintenance perspective, keeping expressions
simpler would have more benefit.


I hope this is helpful.

. . . . . . . . Ken


--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   
mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>