Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7029029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:29:03+00:00 2026-05-28T00:29:03+00:00

I’m building a question / answer wizard that uses xsl to generate the html

  • 0

I’m building a question / answer wizard that uses xsl to generate the html and sent back using ajax. I’ve stared at this issue too long and hoping fresh eyes help spot my prob!

I output the question options ok but trouble setting a previously submitted answer. If I do the following no match happens and therefore no radio button selected. The transform is server side in asp.net, since diff engines can be a bit different.

<xsl:for-each select="Options/Option">
...
<xsl:value-of select="/ExpertData/Answers//Answer[@QuestionGuid = ../../QuestionGuid]">   </xsl:value-of>
...
</xsl:for-each>

If I have the following (hard coded to one of the guid’s it works. Not sure then what the above path would be to correct it?

<xsl:value-of select="/ExpertData/Answers//Answer[@QuestionGuid = '450ea4d6-a2e8-e011-9787-2c27d71e99a6']"></xsl:value-of>

The XML general format …

<?xml version="1.0" encoding="utf-8">
<ExpertData xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Questions>
    <Question xsi:type="RelevantQuestion">
        <QuestionGuid>450ea4d6-a2e8-e011-9787-2c27d71e99a6</QuestionGuid>
        <ItemGuid>440ea4d6-a2e8-e011-9787-2c27d71e99a6</ItemGuid>
        <ElementGuid>f23ef2cc-9a1c-4833-995d-c7ddffec33fa</ElementGuid>
        <QuestionText>Is the Classification Item relevent to this road section?</QuestionText>
        <FieldType>Radio</FieldType>
        <QuestionHelpText>Help text...</QuestionHelpText>
        <Options>
            <Option>
                <OptionGuid>4b0ea4d6-a2e8-e011-9787-2c27d71e99a6</OptionGuid>
                <OptionText>Yes</OptionText>
                <IsDefault>false</IsDefault>
            </Option>
            <Option>
                <OptionGuid>4c0ea4d6-a2e8-e011-9787-2c27d71e99a6</OptionGuid>
                <OptionText>No</OptionText>
                <IsDefault>false</IsDefault>
            </Option>
        </Options>
        <ReliabilityOptions />
        <QuestionValidationList />
    </Question>
    <Question>
        <QuestionGuid>460ea4d6-a2e8-e011-9787-2c27d71e99a6</QuestionGuid>
        <ItemGuid>440ea4d6-a2e8-e011-9787-2c27d71e99a6</ItemGuid>
        <ElementGuid>f23ef2cc-9a1c-4833-995d-c7ddffec33fa</ElementGuid>
        <QuestionText>Please select the road type</QuestionText>
        <FieldType>Radio</FieldType>
        <Options>
            <Option>
                <OptionGuid>4d0ea4d6-a2e8-e011-9787-2c27d71e99a6</OptionGuid>
                <OptionText>2 lane undivided</OptionText>
                <IsDefault>false</IsDefault>
            </Option>
            <Option>
                <OptionGuid>4e0ea4d6-a2e8-e011-9787-2c27d71e99a6</OptionGuid>
                <OptionText>2 lane divided</OptionText>
                <IsDefault>false</IsDefault>
            </Option>
        </Options>
        <ReliabilityOptions />
        <QuestionValidationList />
    </Question>
</Questions>
<Answers>
    <Answer QuestionGuid="450ea4d6-a2e8-e011-9787-2c27d71e99a6">
        <AnswerValue>Yes</AnswerValue>
        <ReliabilityOptionGuid xsi:nil="true" />
    </Answer>
    <Answer QuestionGuid="460ea4d6-a2e8-e011-9787-2c27d71e99a6">
        <AnswerValue>2 lane undivided</AnswerValue>
        <ReliabilityOptionGuid xsi:nil="true" />
    </Answer>
</Answers>
</ExpertData>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:29:04+00:00Added an answer on May 28, 2026 at 12:29 am

    In general, get a reference to the current context node using the current() function:

    /ExpertData/Answers/Answer
        [@QuestionGuid=current()/../../QuestionGuid]/AnswerValue
    

    Or, using a relative path, like this:

    ../../../../Answers/Answer
        [@QuestionGuid=current()/../../QuestionGuid]/AnswerValue
    

    Even better, saving a reference to the current question allows you to write the path without backtracking up the document tree:

    <xsl:template match="Question">
        <xsl:variable name="guid" select="QuestionGuid"/>
        <xsl:for-each select="Options/Option">
            <xsl:value-of
                select="../../../../Answers/Answer[@QuestionGuid=$guid]/AnswerValue">
            </xsl:value-of>
        </xsl:for-each>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.