In V2.0 it will be possible by subclassing getMarkupFragment(String id). Don't think it'll be easy in 1.2
Juergen On 10/26/06, Wouter Huijnink <[EMAIL PROTECTED]> wrote: > Hi list, > > We have a domain class containing an XML string that needs to be > transformed to XHTML, but we'd like to have a 2-phase transformation: an > XSLT to generate wicket markup, and then a parsing and binding of this > generated markup, using BookmarkablePageLink and other wicket components. > > Is it possible to inject new markup elements into the wicket page > representation, and bind these new elements to Component instances? > > ___ > In more detail: > We want to display a domain class that has an XML string as one of its > members: > > public class DomainClass { > private String title; > private String introText; > private String xml; > > ... > } > > In order to properly display a DomainClass on a page, the xml needs to > be transformed to XHTML. However, this XHTML is supposed to contain > links to wicket pages that will have to be built by the transforming > component, as we don't want the XSLT to contain hard-coded links. > > XML: > <e:text> > <e:p> > <e:asset src="happy-user.png"/> > </e:p> > <e:p> > Videbam enim plenam ecclesiam, et alius sic ibat, alius autem > sic. mihi autem displicebat, quod agebam in saeculo, et oneri mihi erat > valde, non iam inflammantibus cupiditatibus, ut solebant, spe honoris > et <e:keyword-ref keyword-id="money">pecuniae</e:keyword-ref>pecuniae ad > tolerandam illam servitutem tam gravem. iam enim me illa non > delectabant, prae ulcedine tua et decore domus tuae, quam dilexi; > </e:p> > </e:text> > > the wicket markup for displaying a DomainClass would be > <div wicket:id="domainClassOutput"> > <span wicket:id="title" class="title">domainClassTitle</span><br /> > <span wicket:id="intro" class="intro">domainClassIntroText</span><br /> > <span wicket:id="formattedText" > class="text">domainClassText</span><br /> > </div> > > The endresult we want for the XML transformation is: > <p> > <img src="http://myserver/_img/happy-user.png" alt="happy user" /> > </p> > <p> > Videbam enim plenam ecclesiam, et alius sic ibat, alius autem > sic. mihi autem displicebat, quod agebam in saeculo, et oneri mihi erat > valde, non iam inflammantibus cupiditatibus, ut solebant, spe honoris > et <a > href="http://myserver/app/mountedBookmarkablePage/keyword/money">pecuniae</a> > ad tolerandam illam servitutem tam gravem. iam enim me illa non > delectabant, prae ulcedine tua et decore domus tuae, quam dilexi; > <p> > > The easy way would be to use 1 XSLT, generating the above XHTML > directly, using hardcoded URLs for images and internal links. We'd > really prefer to use wicket components instead of hard coded links, > though - so we'd need an intermediate, dynamic wicket markup like this: > > <p> > <img wicket:id="dynamicImage1" /> > </p> > <p> > Videbam enim plenam ecclesiam, et alius sic ibat, alius autem > sic. mihi autem displicebat, quod agebam in saeculo, et oneri mihi erat > valde, non iam inflammantibus cupiditatibus, ut solebant, spe honoris > et <a wicket:id="dynamicLink1">pecuniae</a> ad tolerandam illam > servitutem tam gravem. iam enim me illa non delectabant, prae ulcedine > tua et decore domus tuae, quam dilexi; > <p> > > which can be bound in the code by doing something like this: > > [for each image that was found in the parsed xml] > WebMarkupContainer webMarkupContainer = new > WebMarkupContainer(dynamicImgId); > webMarkupContainer.add(new AttributeModifier("src", true, new > Model(getImagePath(imageName)))); > this.add(webMarkupContainer); > > [for each keyword reference that was found in the parsed xml] > BookmarkablePageLink link = new BookmarkablePageLink(dynamicLinkId, > KeywordPage.class); > this.add(link); > > > Any suggestions as to how to accomplish this? > > Regards, > Wouter > > -- > Wouter Huijnink > Func. Internet Integration > W http://www.func.nl > T +31 20 4230000 > F +31 20 4223500 > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user