Jump to content

webbenny

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

1 Neutral

About webbenny

  • Rank
    Newbie
  1. Hmm.. Yes you're right! I was looking for a very generic expression of my problem.. The main cause is, that I've a source structure which allows some nested xml elements but the result xml doesn't allow this element inside another element. so I've to close and reopen it. Do you recommend to use for-each-group (which helped me a lot in this case!) or is there another posibility?
  2. Hello! I've the following XML structure: <root> <title1>Titel 1</title1> <para>Para 1</para> <para>Para 2</para> <para>Para 3</para> <title2>Title 2</title2> <para>Para 1</para> <para>Para 2</para> <title3>Title 3<3/title> <para>Para 1</para> <para>Para 2</para> <title1>Title 1<1/title> <para>Para 1</para> <para>Para 2</para></root> And the output should be: <?xml version="1.0"?><root> <layer0> <title>Titel 1</title> <para>Para 1</para> <para>Para 2</para> <para>Para 3</para> <layer1> <title>Title 2</title> <para>Para 1</para> <para>Para 2</para> <layer2> <title>Title 3</title> <para>Para 1</para> <para>Para 2</para> </layer2> </layer1> </layer0> <layer0> <title>Titel 1</title> <para>Para 1</para> <para>Para 2</para> <para>Para 3</para> </layer0></root> According to the example at http://www.dpawson.c....html#d5010e528 I've tried to do this.. But it seems to be impossible. My xslt output is a endless nested xml or a flat xml..Hast anybody done something similar? Best regards,webbenny
  3. Hi there, maybe I've a very easy problem to solve, but I haven't found a solution yet.... I've downsized the problem to a easy page: http://benjamin.tauf.../frameless.html The problem here is: If I jump to an anchor (click middle in the #leftnav), my #content scrolls to far (the jump destination is not vissible)... I wan't the scrollbar, if the #content needs one Yes, I know I can preserve the overlay with z-index.. But I haven't add it, to keep the example as simple as possible. Has anybody done something similar or any hint? (Solution should work on FF) Regards,webbenny
  4. Yes, you are very right. I'm very sorry, it was only a copy-and-paste snippet from the whole document. I've added a <misc> root element. So it should be well formed..
  5. Hi everybody! I try to transform a xml file. I've the very basic problem, that I need to close and reopen tags in xslt (ok, this maybe is not the problem even if I think it is.. ). My input structure is like: <?xml version="1.0" encoding="UTF-8"?><misc><list> <listitem> <para>some text..</para> </listitem> <listitem> <para>Here is some more text. <note> <para>This is my notice in a para..</para> </note> find even more here ;-) </para> </listitem></list></misc> ...and I wanna get a result like this because I'm not allowed to use <note> in a <para>: <?xml version="1.0" encoding="UTF-8"?><misc><list><listitem> <para>some text..</para></listitem><listitem> <para>Here is some more text.</para></listitem></list><note><para>This is my notice in a para..</para></note><list continue="true"><listitem>find even more here ;-)</listitem></list></misc> Here is what I'm working on.. <?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"><xsl:template match="list"><xsl:choose> <xsl:when test="descendant::note"> <!-- here I need something like split the list? --> </xsl:when> <xsl:otherwise> <xsl:element name="list"> <xsl:apply-templates/> </xsl:element> </xsl:otherwise></xsl:choose></xsl:template><xsl:template match="listitem"><xsl:element name="listitem"></xsl:element></xsl:template></xsl:stylesheet> Thanks for any approach!webbenny
  6. Wow! It works great! I don't even know the "for-each-group" functionality in xsl... ;-) But one more reason to learn all that..The wrapping of white space content into para elements is also required, so it fits perfect for my case.Thank you so much!
  7. Hello there!I've the following XML structure here: <list> <item>Enter your name at field <emphasis>name</emphasis>.</item> <item>Enter your <emphasis>Passwort</emphasis>.</item> <item>Confirm with <emphasis>OK</emphasis>.<para>The system checks the password.</para> <para>Follow the instructions.</para> </item></list> After the tranformation the result should be: <itemizedlist> <listitem><para>Enter your name at field <em>name</em>.</para></listitem> <listitem><para>Enter your <em>Passwort</em>.</para></listitem> <listitem><para>Confirm with <em>OK</em>.</para><para>The system checks the password.</para> <para>Follow the instructions.</para> </listitem></itemizedlist> My current stylesheet is: <xsl:template match="emphasis"> <xsl:element name="em"> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="list"> <xsl:element name="itemizedlist"> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="item"> <xsl:element name="listitem"> <xsl:choose> <xsl:when test="./para and ./text()"> <xsl:if test="parent::item"></xsl:if> <xsl:if test="./text()"> <xsl:element name="para"> <xsl:value-of select="./text()"/> </xsl:element> </xsl:if> </xsl:when> <xsl:when test="item[child::node() != 'para']"> <xsl:apply-templates/> </xsl:when> <xsl:otherwise> <xsl:element name="para"> <xsl:apply-templates/> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> The requirements are:* Each listitem content MUST be in a para!* The element in item an para MUST be processed by the stylesheetWith that stylesheet I always run in trouble, if the item element has text AND child elements.Has anybody some ideas for that case? Thank you very much..Regards, webbenny
×
×
  • Create New...