Coder Social home page Coder Social logo

Dates in XPath about dhclass-hub HOT 13 CLOSED

ebeshero avatar ebeshero commented on August 22, 2024
Dates in XPath

from dhclass-hub.

Comments (13)

nlottig94 avatar nlottig94 commented on August 22, 2024

You need to find exactly what you want in @when before you tell XPath what to output...

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

Consider that format-date() will also be useful in defining what exactly you want from when , but first you need another function! One that says I only want the @when that contain blah, blah, blah

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

The rest of what you have @blawrence719 makes sense in saying how far down you want to go before explaining the contains() with //date/@when but you need to go further in the @when before saying how you want to output your results (which also looks good!) just like @nlottig94 suggests

from dhclass-hub.

blawrence719 avatar blawrence719 commented on August 22, 2024

i'm still not sure how to go further down in @when since all it contains is numbers without it being output into something else. I'm sorry if this is simple, I'm just not getting it. @RJP43

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

What I have seen with questions posed in this issue by @blawrence719 and through text messages with @nlottig94 and Brooke the stumbling point on question 5B is forgetting where you are in your XPath when you are drilled down all the way into the format-date () function. Important to remember that you haven't completed what is required in the contains () function just by specifying what is in the format-date() function.In fact that is only half of the contains() function. Don't forget the examples from class and notice the format for contains (contains(.,"text")) remember the dot is the anchor or the place holder saying search from here for whatever is coming after the comma and for this question the dot is specified in the drilling down into the specifically formatted date. Very basically your steps are go way down in and find all the dates (specifically styled like blah blah) and grab those . that contain text indicating "Fridays" and then output the resulting Friday dates formatted like this (your choice in format). HOPE THIS HELPS ! Think simple and think in steps!

from dhclass-hub.

brookestewart avatar brookestewart commented on August 22, 2024

I honestly don't know what the question is asking us to do... are we working with the dates in the attribute value? or the actual text? I'm so confused...
Would I be correct in assuming that we're to find the Friday dates first, then go from there?

from dhclass-hub.

brookestewart avatar brookestewart commented on August 22, 2024

This is what I have, I'm not sure if it's what the question is asking, but there's a Wednesday in there that I can't get rid of. //date[contains(.,"F ")]/@when/format-date(., "[FNn]/ [M]/ [D]/ [Y]")

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

so you are on the right track but you want to combine these two functions... think how you would incorporate format-date() into the contains() function also be careful with format-date you have the function setup not exactly how its supposed to be remember the example from the assignment //some-XPath-here-that-leads-to-the-dates-you-want/format-date(xs:date(.), '[FNn]/ [MNn]/ [Dwo] / [YWw') also look back at what I said to the other Brooke about the dot we typically see in contains is being replaced with the format-date() function's dot. @blawrence719 or @nlottig94 care to hint to @brookestewart where she is confusing things?

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

Simplify your thinking of what you want. Remember you want to drop down as deep as you can before you start telling XPath what you want to pull out.

This way of thinking might help: Very basically your steps are go way down in and find all the dates (specifically styled like blah blah) and grab those . that contain text indicating "Fridays" and then output the resulting Friday dates formatted like this (your choice in format).

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

@nlottig94 you have a really great sense of explaining the parts of format-date()care to give some input explaining what @brookestewart has versus what she would want to have? Perhaps just by giving the clear explanation of the different parts of the format-date() function that she is representing we can get a clearer sense of what would make sense to keep or not when combining it with the contains() function.

from dhclass-hub.

RJP43 avatar RJP43 commented on August 22, 2024

the question is asking that you go into the when attributes of date and you grab all of the dates (that are formatted in a specific way) that contain Fridays (some kind of text to indicate Fridays) and then output the dates in a format of your choice. Be careful of where you are stepping further / and where you are saying take this from this point .

from dhclass-hub.

brookestewart avatar brookestewart commented on August 22, 2024

I'm still having a lot of trouble. Is this correct so far? //date[text()[contains(., "F ")]]/@when

from dhclass-hub.

ghbondar avatar ghbondar commented on August 22, 2024

Try including the when-attribute earlier in you search tree, such as //date/@when. You can either use the contains-fcn. as a predicate, or you can add it to the tree as well. However, within the contains-fcn., you are doing more than simply referring to the preceding steps in the hierarchy the ..
Instead, the haystack that you need to search through consists of formatted dates as xs:date, so use them in the contains-fcn:
contains(format-date(xs:date(.), '[whatNeedleDoYouWantToFind]')
@brookestewart

from dhclass-hub.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.