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 July 27th, 2005, 07:21 AM
Authorized User
 
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help in referencing xml element in xsl using ("")?

hello every one
i got an xml doc and in it i got a refernece to an answer
e.g:
<response_label ident="CE296EA2163111D8C6E4DBF3F4597FC1"
rarea="Ellipse" rrange="Exact" shuffle="Yes">
how can i refernce that Ident in the following code
using xsl sheet:
<Question number="" options="" ref="I WANTED TO BE DISPLAYED HERE">
in general how can i reference an xml elemet in xsl sheet using ("")
in help please


 
Old July 28th, 2005, 01:42 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Do you want to store the path to the response? If so you could have
Code:
//response_label[@ident = 'CE296EA2163111D8C6E4DBF3F4597FC1']
Two things, this is an inefficient path, as are most starting with //. If I knew the structure of the document more precisely then I could suggest a better one. Secondly you won't be able to use this string to access the element unless you are using a processor such as Saxon that has extensions for this; XPath does not allow for dynamic evaluation of strings as paths.

Instead you could just store the ident in the ref attribute and use the path
Code:
//response_label[@ident = current()/@ref]
assuming the context node at that point is the Question element.

--

Joe (Microsoft MVP - XML)
 
Old July 28th, 2005, 03:38 AM
Authorized User
 
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

@Joe
thanks for answering i'm using xmlspy2005 enterprise evaluation copy
i think i figured it out with the following xsl code
    <xsl:attribute name="number">
                      <xsl:value-of select="number(position())" />
                      </xsl:attribute>
                     <xsl:attribute name="options">
                  <xsl:value-of select=" count(./presentation/flow/flow/response_lid/render_choice/flow_label/response_label/flow_mat/material/mat_extension/mat_formattedtext)" />
                      </xsl:attribute>
                   <xsl:attribute name="ref">
                      <xsl:value-of select="./resprocessing/respcondition/conditionvar" />
                              </xsl:attribute>
it was a matter of xpath as u said
thanx once more for ur guidance






Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL(T) problems with xsl:element pan69 XSLT 3 December 13th, 2007 06:24 AM
XML element referencing to other xmls alexhinz XSLT 0 February 8th, 2007 09:32 AM
xsl element identification vakorde XSLT 4 May 7th, 2006 04:48 AM
REferencing xsl sheets in firefox lincsimp XSLT 0 September 11th, 2005 07:04 AM
XSL and Referencing Entities arron_v2003 XSLT 0 March 4th, 2004 05:49 PM





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