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 January 20th, 2009, 08:50 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Returning Element value

Hi,

I can't seem to return the 'DocPurpose' element in the following code extract:

Code:
 
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
 <Header>
  <MessageId>{blah}</MessageId>    
  <RequestMessageId/>
 </Header>
 <Body>
  <VCTMovementInstruction xmlns="http://schemas.microsoft.com/dynamic...entInstruction">
   <DocPurpose>Original</DocPurpose>
 </Body>
</Envelope>
I can access the 'VCTMovementInstruction' (.//Body/*) but can't remember the code to obtain the subsequent node.

Can anyone help please?

Thanks in advance,
__________________
Neal

A Northern Soul
 
Old January 20th, 2009, 08:56 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Well the VCTMovementInstruction and its child DocPurpose are in the namespace http://schemas.microsoft.com/dynamic...entInstruction so you need to bind a prefix to that namespace URI and use the prefix to qualify the element names:
Code:
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0"
  xmlns:mi="http://schemas.microsoft.com/dynamics/2006/02/documents/VCTMovementInstruction">

  <xsl:template match="/">
     <xsl:value-of select="Envelope/Body/mi:VCTMovementInstruction/mi:DocPurpose"/>
  </xsl:template>

</xsl:stylesheet>
Note that the forum software seems to shorten URIs so make sure you use the full URI http://schemas.microsoft.com/dynamic...entInstruction
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
Neal (January 20th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
returning interfaces mike72 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 April 17th, 2008 05:53 AM
Returning a value Neal XSLT 6 October 13th, 2006 11:41 AM
translate element name to element name lexzeus XSLT 3 September 4th, 2006 09:04 AM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM





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