XPP 9.0 CSS functionality as opposed to traditional XML functionality

A question that is, I think, fundamental to XPP 9.0 going forward - I will keep the example fairly simple! I don't think the below can be achieved currently but please tell me I am wrong - otherwise I feel an RFE coming on.

We need to add space at a point where the only uniqueness is that its the first instance of the parent - so in XPP (traditional XML) we would put in the x-path section/chapter[1]/heading or section/chapter[postion()=1]/heading.

So converting to CSS I really need to do something like section > chapter:first-of-type > heading but it appears that is not allowed (the first-of-type only works on the last element in the selector).

So what are the alternatives - well the obvious one would be to use XyPerl, but you can't do that from within the selector definition unless it is :before or :after - but the before gets overridden when you actually get the the output phase.

So now the only alternative I can see is to transform the XML and add attributes to indicate "first-of-type" (ie first-of-type="yes") but for us we am dealing with customer supplied XML and, although I may be able to do this for some customers, there may be occassions where I can't.

Does anyone else have anything to add to this or should I raise an RFE immediately - just wait for the Conference in Santa Fe - the Wish List / Strategic Roundtable sessions just got more interesting!

PS If you have not registered for the Conference yet then its only 4 weeks to go.

Parents
  • Chris,

    I did some testing and found that things were working OK.

    I do not have your complete example to work with so I have build a small test division which looks like this:

    (yes I know that is very incorrect html)

    and I have the following CSS applied to it in XPP

    and this is the output in XPP:

    That looks correct to me.
    So it might very well be that something else is going on in your case..

    PS: you can even use the combination of the 2 pseudo classes in order to generate content only on the first para within the first div like:

    div:first-of-type > p:first-of-type:before {

    content: "Added "

    }

Reply
  • Chris,

    I did some testing and found that things were working OK.

    I do not have your complete example to work with so I have build a small test division which looks like this:

    (yes I know that is very incorrect html)

    and I have the following CSS applied to it in XPP

    and this is the output in XPP:

    That looks correct to me.
    So it might very well be that something else is going on in your case..

    PS: you can even use the combination of the 2 pseudo classes in order to generate content only on the first para within the first div like:

    div:first-of-type > p:first-of-type:before {

    content: "Added "

    }

Children