Just tested it with an almost empty setup, and that worked. (I did this: * From https://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/inline-xsl-example-modify-text/, i copied the rules.xml as rules-test.xml, * added <theme href="theme-test.html" /> * copied theme.html as theme-test.html, * added an alternate theme in collective.xdv setup: use rules-test.xml for content item called "test", * i was able to append text to p's, span's etcetera.)
Probably my rules.xml does something stupid, but i can't figure out what it is. Is there a way to debug? (Perhaps it is helpful if i post my rules file: http://pastie.org/1235085.) Kees On 10/20/2010 12:00 PM, Kees Hink wrote: > Hi Laurence, thanks again for your time. > > Following your second suggestion: > <xsl:template match="h2/text()"><xsl:copy /> - Some extra text</xsl:template> > just doesn't work. The HTML has subheadings (H2's) in it, but they are not > modified. > > Matching on the title: > <xsl:template match="title/text()"><xsl:copy /> - Some extra > text</xsl:template> > does work. > > Do you have any suggestions as to how i might get debugging output? It seems > strange that the example code (an automated test for xdv, right?) works and it > won't work in a/my collective.xdv setup. > > To be clear, these subheadings were placed in the theme by other rules. The > rule that tries to append text to the subheading is the last on in the rules > file, however, so i'd think the rule would operate on the whole theme as it is > at that point. The html title is also taken from the content, but was present > in the theme before any rules were applied. (What i'm trying to achieve is to > rewrite the src attribute of selected img elements which were placed in the > theme from the content.) > > Where does <xsl:template /> fit in the xdv rules execution order? > (http://pypi.python.org/pypi/xdv#order-of-rule-execution) I've currently > defined it outside of any append/prepend rules, as in the example at > https://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/inline-xsl-example-modify-text/rules.xml. > > Kees > > > On 10/19/2010 05:01 PM, Laurence Rowe wrote: >> >> The attribute modification required an <xsl:attribute>: >> https://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/inline-xsl-example-modify-attribute >> >> Not sure what the issue was with the h2s: >> https://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/inline-xsl-example-modify-text >> >> Laurence >> >> >> Kees Hink wrote: >>> >>> Hi Laurence, >>> >>> Thanks for pointing this out. I couldn't get this to work, however. I >>> appended >>> the snippet you suggested at the end of my rules file, but there was no >>> noticable change. Even when i made the query less specific by removing the >>> "/@src[not(contains(., '@@'))]" from the selector, there was nog change in >>> image src urls. >>> >>> I experimented with the example at >>> http://codespeak.net/svn/z3/xdv/trunk/lib/xdv/tests/copy-xsl/rules.xml. I >>> can >>> indeed replace some characters in the html head title in this way >>> (match="html/head/title/text()"). I also succeeded in appending text there >>> (using the <xsl:copy /> statement). However, when i change the selector to >>> match all h2's in the page (match="//h2/text()), it doesn't work. >>> match="//title/text()" does work, however. >>> >>> Do you have any other ideas as to what i'm doing wrong? >>> >>> Kees >>> >>> PS version info: >>> collective.xdv-1.0rc11 >>> xdv-0.4b2 >>> >>> On 10/18/2010 02:16 PM, Laurence Rowe wrote: >>>> >>>> >>>> Kees Hink wrote: >>>>> >>>>> I'm trying to do something with collective.xdv that just might be too >>>>> ambitious. I'd like some advice. >>>>> >>>>> I'm trying so replace all image source urls from a specific element with >>>>> urls >>>>> that point to a scaled version of the image. So ' some-image ' >>>>> should be ' some-image/@@images/image/thumb '. >>>>> >>>>> Use case: I'm taking entire Collage-items out of the Collage and putting >>>>> them >>>>> in another layout. (I don't loop over individual img elements.) This is >>>>> actually a problem with Collage, but Collage "fixes" it by specifying >>>>> "width:100%" for images inside it. The downside of this is that content >>>>> editors >>>>> _will_ insert 2Mb images which the user will have to download (only to >>>>> be >>>>> rendered as 180x180). I could use this "fix" for the theme as well, but >>>>> (while >>>>> acceptable for the Plone back-end) having such large images on a public >>>>> site is >>>>> just immoral. >>>>> >>>>> I read [1] that you can specify search-and-replace in xslt, but how >>>>> could >>>>> one >>>>> get this to work in collective.xdv? >>>>> >>>>> (We use various image sizes in the site, so setting an alias for /view >>>>> which >>>>> redirects to the scaled size will have side effects.) >>>>> >>>> >>>> I would do something like: >>>> >>>> <xsl:template match="img/@src[not(contains(., >>>> '@@'))]"><xsl:copy/>/@@/images/image/thumb</xsl:template> >>>> >>>> For more complex string operations you need the exslt string namespace. >>>> See >>>> http://plone.293351.n2.nabble.com/XDV-guru-how-drop-a-substring-td5608087.html >>>> >>>> Laurence >>> _______________________________________________ >>> Product-Developers mailing list >>> product-developers-g3yhmj00slolbbk5bonkug-xmd5yjdbdmrexy1tmh2...@public.gmane.org >>> http://lists.plone.org/mailman/listinfo/product-developers >>> >>> _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
