Subject: Re: [xsl] would like to simplify my XSLT From: Glen Mazza <grm7793@xxxxxxxxx> Date: Mon, 29 Jan 2007 19:14:44 -0800 (PST) |
--- Abel Braaksma <abel.online@xxxxxxxxx> wrote: > Abel Braaksma wrote: > > > > You are using translate(), which hints (imo) that > you are using XSLT > > 1. Can you confirm? Or do you use XSLT 2 (this > highly influences the > > answers you will get)? > > Here's one solution. I believe it will work on both > 1.0 and 2.0, but I > tested only 2.0. > > <xsl:template match="* | text()"> > <xsl:apply-templates /> > </xsl:template> > Newbie question here--but why do you match on "* | text()" instead of just matching on "/"? (I saw the physical answer--by matching on the latter I got a lot of strange white space--but I'm not sure why.) > <xsl:template match=" > person[document[ > not(@relid = > > ../../../documents/document/@id)]]"> > > <person name="{name}" /> > </xsl:template> > > It will output all persons that have at least one > not-matching @relid, > like this, for your input: > > <person name="Chris" /> > That's correct, but this is not exactly what I needed. I wanted names of people who didn't have *any* documents in the document list--Chris shouldn't appear because he had one of his two documents there. By removing the "not" in your XPATH above, that gave me people who have at least one document in the document list, useful but still not what I was looking for. I'll check the other responses to see if they will help. > Your own code much resembles the way you may do it > in imperative > languages like Java, PHP, VB or C. However, using > templates, you can let > the processor do the math for you and you only have > to draw the rules. > I know -- I come from a Java background so that's how my XSLT will currently look until I figure out how to do things better! > Cheers, > -- Abel Braaksma > http://www.nuntia.nl > Thanks much! Glen ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] would like to simplify my, Abel Braaksma | Thread | Re: [xsl] would like to simplify my, Abel Braaksma |
[xsl] Copying nested tags and addin, graeme.ludwig | Date | Re: [xsl] would like to simplify my, Glen Mazza |
Month |