Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 15th, 2011, 06:52 PM
Authorized User
Join Date: Jul 2010
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default absolute path vs relative path for substitution group elements

Hello All,
I'm running into an issue in my xslt where using the relative path resolves correctly but the absolute path does not.
The following is the sample xml:

        <cicjis-mitt-ext:EntityPerson s:id="PER39176212">

The following is a snippet of the xslt code to retrieve the PersonEyeColorText using absolute path that doesn't work:

<xsl:template match="cicjis-mitt-ext:Case">
<xsl:value-of select="normalize-space(cicjis-mitt-ext:CaseAugmentation/j:CaseDefendantParty/cicjis-mitt-ext:EntityPerson/nc:PersonEyeColorText)"/>

The following is a snippet of the xslt code that uses the relative path expression which does work:

<xsl:template match="cicjis-mitt-ext:Case">

<xsl:value-of select="normalize-space(//cicjis-mitt-ext:EntityPerson/nc:PersonEyeColorText)"/>

I am confused as to why the absolute path is not working. Am I missing something? The path looks correct to me. I'm wondering if this has to do with the way the cicjis-mitt-ext:EntityPerson is defined in the schema. In the schema, the j:CaseDefendantParty contains an abstract element called nc:EntityRepresentation and cicjis-mitt-ext:EntityPerson is substituted for this using substitutionGroup.

Any help is appreciated!! Thanks in Advance!
Old June 15th, 2011, 07:15 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

The only explanation I can think of is that the namespace bindings in the stylesheet don't match those in the source document. You haven't shown either, which could indicate that you haven't realised how important it is to get these right.
Michael Kay
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
ptn77 (June 16th, 2011)
Old June 16th, 2011, 09:58 AM
Authorized User
Join Date: Jul 2010
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts

Sorry forgot to post the namespace bindings. The following is the namespace bindings:

Old June 16th, 2011, 10:04 AM
Authorized User
Join Date: Jul 2010
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default Found my problem

After posting the namespace bindings, I went back to the schemas to make sure my namespaces were all correct and found that there was one mistake. The binding for "j" in the schema was version 4.1 instead of 4.0. After fixing this, the absolute path resolved.


Thank you!!!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Relative and Absolute Path question Johnger Pro Visual Basic 2005 1 September 8th, 2006 10:45 AM
absolute path required?? atila Crystal Reports 0 April 29th, 2006 06:31 AM
VSProject need absolute path to the references acuze C# 0 April 18th, 2006 06:06 PM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Absolute Path in Crystal Report lam_lvl Crystal Reports 5 August 19th, 2004 05:50 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.