Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Code:
The following is the sample xml:

<MittimusDocument>
  <cicjis-mitt-ext:Case>
    <cicjis-mitt-ext:CaseAugmentation>
      <j:CaseDefendantParty>
        <cicjis-mitt-ext:EntityPerson s:id="PER39176212">
          <nc:PersonEyeColorText>Brown</nc:PersonEyeColorText>
        </cicjis-mitt-ext:EntityPerson>
      </j:CaseDefendantParty>
    </cicjis-mitt-ext:CaseAugmentation>
  </cicjis-mitt-ext:Case>
</MittimusDocument>

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)"/>
</xsl:template>

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)"/>

</xsl:template>
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!
Reply With Quote
  #2 (permalink)  
Old June 15th, 2011, 07:15 PM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
Reply With Quote
The Following User Says Thank You to mhkay For This Useful Post:
ptn77 (June 16th, 2011)
  #3 (permalink)  
Old June 16th, 2011, 09:58 AM
Authorized User
 
Join Date: Jul 2010
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default

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

Code:
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:ccis="http://www.cbi.state.co.us/CCIS"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
  	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  	xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
  	xmlns:user="urn:schemas-xmlandasp-net:xslt"
  	xmlns:ch="http://localhost/"
	xmlns:j="http://niem.gov/niem/domains/jxdm/4.0"
	xmlns:nc="http://niem.gov/niem/niem-core/2.0"
	xmlns:cicjis-ext="http://www.colorado.gov/cicjis/IEPD/CICJIS/extensions/1.0"
	xmlns:cicjis-mitt="http://www.colorado.gov/cicjis/IEPD/Mittimus/1.0" 
	xmlns:cicjis-mitt-ext="http://www.colorado.gov/cicjis/IEPD/Mittimus/extensions/1.0"
	xmlns:s="http://niem.gov/niem/structures/2.0">
Reply With Quote
  #4 (permalink)  
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.

xmlns:j="http://niem.gov/niem/domains/jxdm/4.1"


Thank you!!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:38 AM.


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