This does sound interesting Roger - I'd love to know the title of the textbook, if you can recommend it. Might make good holiday reading! Al
Neophyte30
Posts
-
Annoying Instructor Behaviors -
CCC 24/8/11I have a theory about the theme... not sure if I should guess in case it spoils it...
-
CCC 24/8/11Thankyou! - although I was inspired by your mention of nap - it suddenly leapt out at me... :-D
-
CCC 24/8/11Napoleon? Sleep - nap approved by Spaniard - ole working - on is a little complex = Napoleon complex?
-
xsl:apply-templates help please! [modified]Thanks for this - I had found the "following-sibling" axis on a tutorial page somewhere which led me to:
<xsl:for-each select="Beds/*/*">
xsl:choose
<xsl:when test="not(contains(name(.),'Code')) and .>0">
<Row>
<Description>
<xsl:value-of select="name(..)"/>
<xsl:value-of select="name(.)"/>
</Description>
<Value>
<xsl:value-of select="following-sibling::*[contains(name(),name(.))]"/>
</Value>
<Quantity>
<xsl:value-of select="."/>
</Quantity>
</Row>
</xsl:when>
</xsl:choose>
</xsl:for-each>Your solution demonstrates to me that I have hardly scratched the surface of XPath, and that there are many ways of achieving the same result! Is there a performance (or other) benefit to using templates apart from the feeling of doing things properly as opposed to my schonky approach? Can you recommend any sites or good books to get a deeper insight into XPath/XSLT? Thanks again for your time, Al Edit--- My use of for-each amply demonstrates the adage that when all you have is a hammer...
-
xsl:apply-templates help please! [modified]OK, I have:
Can anyone point me toward the proper XPath expression to say "sibling that begins with the name of the current element [and ends with 'Code']"? I'd like to sidestep the if, if that's possible...
Thanks,
Al
-
xsl:apply-templates help please! [modified]I am attempting to digest someone elses xml - which is why I can't just reformat it as I'd like. I think that applying templates (possibly nested) is the way to go, but I'm buggered if I can see how to do it properly - the w3schools site covers the basics, but not what I'm after. Can anyone a) solve my problem or b) point me to somewhere I can find a more in-depth explanation? I'd even settle for c) "XSLT does not work that way!" Source XML:
<Beds>
<Single>
<Base>1</Base>
<BaseCode>BER</BaseCode>
<Mattress>2</Mattress>
<MattressCode>BER</MattressCode>
<Headboard>3</Headboard>
<HeadboardCode>BER</HeadboardCode>
</Single>
<Double>
<Base>0</Base>
<BaseCode></BaseCode>
<Mattress>1</Mattress>
<MattressCode>BER</MattressCode>
<Headboard>2</Headboard>
<HeadboardCode>TBD</HeadboardCode>
</Double>
<King>
<Base></Base>
<BaseCode></BaseCode>
<Mattress></Mattress>
<MattressCode></MattressCode>
<Headboard></Headboard>
<HeadboardCode></HeadboardCode>
</King>
<Sofa>
<Foam>5</Foam>
<FoamCode>BER</FoamCode>
<Metal></Metal>
<MetalCode></MetalCode>
</Sofa>
</Beds>Desired Output XML:
<Row>
<Description>SingleBase</Description>
<Value>BER</Value>
<Quantity>1</Quantity>
</Row>
<Row>
<Description>SingleMattress</Description>
<Value>BER</Value>
<Quantity>2</Quantity>
</Row>
<Row>
<Description>SingleHeadboard</Description>
<Value>BER</Value>
<Quantity>3</Quantity>
</Row>
<Row>
<Description>DoubleMattress</Description>
<Value>BER</Value>
<Quantity>1</Quantity>
</Row>
<Row>
<Description>DoubleHeadboard</Description>
<Value>BER</Value>
<Quantity>2</Quantity>
</Row>
<Row>
<Description>SofaFoam</Description>
<Value>BER</Value>
<Quantity>5</Quantity>
</Row>I thought I'd start with:
<xsl:for-each select="Beds">
<Row>
xsl:apply-templates</xsl:apply-templat -
CCCI think my tally is only two, in nearly 4 years of mostly lurking... :~
-
CCCWooHoo! :-D
-
CCCMonastery Working = ON bloomer = ASTER in my = M...Y MONASTERY - houses brother (shouldn't that be friar? :-p)
-
How can I [quickly] differentiate a USB card reader impersonating a keyboard, from the real keyboard?Thanks for this - I had a look and decided it was a bit too involved for a demo - I've gone with option 3 (fake it!) for now, so I can get back to my main project! Cheers, Al
-
USB Card ReaderIt sounds as though you are trying to do the same thing[^] I am. Using the generic HID reader from this page[^], and feeding it the vendor id and product id (which can be found in device manger), I get "The device is a system keyboard. Windows 2000 and Windows XP obtain exclusive access to Input and Output reports for this[sic] devices. Applications can access Feature reports only." Which, frankly, is a bit of a blow. Maybe there is another possible approach?
-
How can I [quickly] differentiate a USB card reader impersonating a keyboard, from the real keyboard?Scenario: I have a USB RFID card reader. It pretends to be a keyboard (HID Keyboard Device) and when a card is swiped, it 'types' the card serial followed by return in to whichever application has focus. I need to capture the serial coming from the reader so I can store arrival and departure times of cards in a database. I have been given 2 (two) days to come up with a demo of this technology for one of our customers! Possible Options: 1) win32 api calls to hook keypresses: I have this working, globally, as I would like it to, but has the disadvantage of capturing keypresses from the standard keyboard - I'm assuming this is not at a low enough level to distinguish between PS/2 and USB keyboards. 2) wmi calls to access the usb device directly: I'm not really sure where to start with this - My language of preference is C#, and it looks like it might be a lengthy task to wrap these calls 3) fake it! Make sure that my demonstrator (a colleague) knows to ensure that the 'scanner' app has focus, and that he should not touch the standard keyboard. I can use standard winforms key events, and even fake the back end DB if necessary. Any suggestions, pointers to tutorials gratefully received!
-
Adding a http header to a web service responseThanks for the reply Marc - although it turns what I was actually being asked was to ensure the Date: response (which is included in all responses currently) stays in the same format. As I believe this format is defined in the HTTP specification, I'm assuming that the format would not change even if we were to upgrade to IIS 7.0 Not sure how to interpret your suggestion - as I am coming at this from self-taught asp.net/c# background - I plan to leave well enough alone, until such time as eveything stops working... Is the Date: header always included, and always in the same format? Thanks again, Alan
-
Adding a http header to a web service responseAs part of a project that communicates with remote hardware via a web service, I have been asked to ensure that all responses include a Date header. Can anyone tell me where I should be looking to implement this? Possible candidates I have (unsuccessfully) considered/researched so far include: settings in IIS 6.0 on the web server settings in the web config of the web service Am I even looking in the right place? Once I have found how to add the header I may also need to be able to format it...
-
Grand Prix Comes Home!Perhaps some kind of Moebius strip?
-
Grand Prix Comes Home!May I humbly suggest "England 5, Germany 1" by The Business? :)
-
A Non-Contentious CCC! [modified]I was also looking at 'comes' around 'it'... Curses!
-
A Non-Contentious CCC! [modified]domestic? struggling with why, though... :confused:
-
CCC I WIN!If this has something to do with Caerphilly, you are a very bad man. :-D