XPath+XSLT: Re-adding parts of the document after XPath eval. (fragment)

Hello all,
Sorry, I know that this is not strictly a Java related problem, but who knows if there are standard API functions for that...
Imagine this simple XML document:
<document>
   <meta>
     [some deeper structs]
   </meta>
   <content>
      <chapter id="1">
      </chapter>
      <chapter id="2">
      </chapter>
      <chapter id="3">
      </chapter>
   </content>
</document>Normally, I transform the entire document via XSLT e.g. to XHTML. But if I want just to extract e.g. the first chapter using XPath evaluation, I do not have other "static" parts of the document, e.g. the meta part or the document root.
Currently, I am adding this very complicated by having the XPath evaluation as a string and by prepending and appending the "static" part in order to have a fully working XSL transformation (e.g. "<document><meta>[...]</meta><content>" + xpathEval + "</content></document>")...
Are there any best practises? I think using XPath is very nice for this kind but maybe the wrong way and I should filter another way? Hope there is an elegant way whith sticking to XPath though...
Thanks and regards,
Timo

Rehi DrClap,
Thanks for your reply.
Yes, that is pretty fine, but the problem is that I have some "static" parts like the "meta" tree are outside the "chapter n" tree.
And just selecting for my chapter will result in just that tree but not the entire document pattern including the document root and the meta part.
XSLT being more SAX'ish, I think I have to rebuild my document using DOM in a way that I do some consecutive XPath selections like for meta and chapter, create the root node, append them and then XSL transform that new document. However, that are much steps and not good for larger documents.
Thx and regards,
Timo

Similar Messages

  • JEditorPane: how to replace small parts of the document?

    Hi
    Im trying to create an application that will allow two people to type into two different JEditorPanes, but have the two people essentially editing the same document. So if one person types someting into thier frame, I want that modification sent to the other frame as well.
    The problem I've come across is how to make changes to the contents of the frame without interfering with the person whos trying to type into it. That problem boils down to how do you replace only a small part of the document whithout taking control of the users caret?

    Hopfully I got your problem right. To change only small parts of the EditorPane's document should not be the probelm you can get it with EditorPane.getDocument(). But I think you have to take control over the caret, because the when user 1 has finished editing and sends the doc to user 2 who is editing the doc, user 2's caret position will change because the document length has changed.
    The easiest way would be to add an input area (TextArea) for each user where they can type theit text and than to add the text into the document when they press enter, so you don't have the trouble with te caret position. If you don't want to do this then you could try that: the input of the users is cached while they are typing (not changing the doc) till they press enter. Then the doc is send to the other user, the users doc in the pane is updated and his current typing is added to the end of the new received doc. You can figure out the correct position by doc.getLength() and set the new caret position to doc.length + currentTyping.length
    Hope that helps
    Eryk

  • I am using Adobe XI Pro and in various parts of the document there is brown / biege lettering when on the document it shows as black.  My printer guy has been in and checked it out top to bottom and that part is fine.  I have tried to print the same docum

    I am using Adobe XI Pro and in various parts of the document there is brown / biege lettering when on the document it shows as black.  My printer guy has been in and checked it out top to bottom and that part is fine.  I have tried to print the same document and it comes out fine.  Any ideas ?   Using Windows 7 Service Pack 1

    Sorry my bad.  I have tried to print the same document on another printer and all the formatting is fine. 

  • When I download files, firefox is adding " .part " to the file name and the file won't open, but if i back the .part out, it opens fine.

    Firefox seems to be adding " .part " to the file names of files I downoad. Here's an example:
    YuT9iNv8.pdf.part
    I cannot open this file because it can't find an application.
    If I back out the .part, I get a box asking if I want to change the extension to .pdf I check yes, and everything works fine. It doesn't happen with other browsers (Safai).

    I get the error message saying the file could not be downloaded due because there is no enough disk space.
    How large is your HD and how much space do you have left?

  • Oversize documents being rendered with parts of the document cut off due to the large size

    We are invoking web services on LiveCycle Server ES 8.2 to convert non pdf documents to pdf. We noticed that oversized documents are rendered with parts of it cut off when submitted for conversion.
    Has anyone seen this before and how we can resolve this?
    Thanks in advance.

    The oversized file issue happens when we try to convert legal size documents. Part of the document is cut off.
    Any documents wider than 8 and 1/2 by 11 has this issues.

  • I created a magazine using a IDD template including bleeds. When I exported to make a PDF, it cut off part of the document when uploading for printing. When I incude bleeds, it makes the document too big for printing. I need help :)

    I created a magazine using a template including bleeds. When I exported to make a PDF, it cut off part of the document when uploading for printing. When I incude bleeds, it makes the document too big for printing. I need help

    eehenry wrote:
    It is a problem with a secondary provider, "mag cloud" .
    Right, so to advise you we'd need to know the particulars of MagCloud's spec for your project; format, trim size, bleed, etc.
    It's doubtful that anything happened "when uploading for printing," so long as you were uploading a PDF, as opposed to the native InDesign file. Did the PDF look right to you before uploading?

  • I am having trouble printing  and am only getting part of the document which i have no margins set any help??

    i am having trouble printing  and am only getting part of the document  i have no margins set any help??

    What version of Pages?
    What Printer?
    If it is Pages '09, turn Comments off.
    Peter

  • I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    I have adobe illustrator CS5. When I save a document as a pdf and open it again later to edit Adobe reader can't read the whole document because it only shows part of the document. It is very frustrating. How can I fix this?

    keokipineapples schrieb:
    I do have all of my files I am working on located on an external drive. I plan to transfer them directly to the hard drive
    Transfer them to your harddisk immediately.
    External drives are not offiially supported and the source of errors of all kinds including complete loss of files.
    Illustrator support for networks and removable media

  • Show part of the document

    For example, I have the following document:
    <url> http://www.abc.com </url>
    <headline> A headline for this article </headline>
    <pub_date> 20001208 </pub_date>
    <text>
    This is a document content
    </text>
    I know that I can use session (field) for the tags.
    Can I compare the content of <pub_date> with the query.
    Can I retrive part of the document, say, just the <text> content only?
    Thanks

    Hi,
    Could you tell me what version of Word are you using?
    Templates (including Normal.dot) are stored in C:\Documents and Settings\user name\Application Data\Microsoft\Templates.
    It’s possible that normal.dot file under your profile is corrupted. You can copy the normal.dot file under the normal profile to your store path.
    If there is anything else that I can do for you regarding this issue, feel free to post back.
    Best regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    I am using adobe photoshop cs6. I am facing a problem. When i save any image as "save for web". After saving image it show cropped. An image show many parts of the image after saving the image. Please help me. Thanks in advance.

    Just go back in photoshop and use the Slice Select tool, then just click and select the slice and hit delete - if you're not sure which one is the active slice just right click and find the one that has the Delete Slice option.
    It's possible you either added the slices by accident or if you received it from someone they just had the slices hidden. For the future, you can go to View > Show > Slices to display (or hide) slices.

  • Re - Submit the document after reaching Lifetime

    Hello Experts,
    i need to re-submit the document after reaches its lifetime, if the user needs that document again?
    this all are done inside Collaboration Room.
    In detail,
    I had created a Users called,
    1) Author (-Permission : R/W-)
    2) Employee (-Permission : Read-)
    Author creating one document and setting lifetime for that document, then the Employee can view the document depends on the LifeTime what Author specified, then the document will not show the Employee( Working till this ).
    but the Employee needs that document again, so he/she have to request for the document after the lifetime reaches.
    How can i acheive this?
    One More thing,
    Notification have to send to the Author once the document got Expired, how it is possible?
    Regards,
    Mythili

    Hi Mythili,
    by enabling the subscription service on the repository you can configure on folder level who should get notifications (Author Group) when documents in this folder expires.
    Unfortunately, this is all you can do within the standard KM functionality.
    In order to create notifications in advance that go to the owner / last editor or / last modifier of the document you need to do some implementation. You could for example create a custom KM report that should run daily and check the expiration date of the documents and send this custom made notifications.
    The specified item was not found. describes here another way of achieving this: document lifetime and resubmission
    Hope this helps,
    Robert

  • I am having trouble with the "numbers" app on my MacBook Air. I go to print my document and that works just fine. I cannot however return to the document after printing. What do I have to do?

    I am having trouble with the "numbers" app on my MacBook Air. I go to print my document and that works just fine. I cannot however return to the document after printing. What do I have to do?

    RR,
    Not to worry, you're not the first to expect Print to finish by returning you to the edit mode. The thing is that Printing is so hit and miss with this version of the app, you will probably want to stay in the Print window for more than one attempt.
    Jerry

  • Can i buy i phone from US and use it in India or different part of the world after unlocking it? if yes, than will apple unlock it or need  to do it by myself?

    can i buy i phone from US and use it in India or different part of the world after unlocking it? if yes, than will apple unlock it or need  to do it by myself?

    There are no officially unlocked iPhone 5's available, in the US, at the present time. No announcement, as to availability has been made. The only unlocked iPhone, available now, is the iPhone 4 or 4S. Either of these versions will work, but will have no warranty or support in India. They can only be purchased directly from Apple, no where else.

  • Showing invisible parts of the document when print is cancelled

    The recommended way to hide content of a form designed in LifeCycle Designer 7.0 is to make the non-printable elements invisible in the prePrint event and to show them again in the postPrint event.
    When the print is initiated, the respective objects become invisible and they are shown again after the print is executed with OK. However, when the print is cancelled by pressing Cancel, no postPrint event occurs and the objects remain invisible.
    We have not found a workaround for this problem which appears to be a major functional issue which makes the advertised way of hiding content for printing not viable. That makes the product unusable for our purposes.
    We have also tried to create a layered PDF with InDesign and adding control elements to this document. The plan was to mark some of the layers as non-printable in Acrobat. However, after we added the control elements, saved the file and opened it in Acrobat, all the layers were lost.
    Is there a way to workaround this problem?

    Thank you for responding. Below is some info.
    Please see the clipping on the "d" in Pastel Bond and White Bond and the rounded part of the "R" in 2 &3 Part NCR. We have had this happen on occasion with other files as well. Thanks for the help.
    save as > photoshop PDF
    First dialogue box:
    Save: layers (checked)
    color: embed color profile: U.S. web coated (SWOP) ...
    Second dialogue box: high quality print
    options: none checked
    viewing PDF in preview on mac

  • Making a password show what parts of the document you see

    I have a random request from a client that I am not sure is even possible.
    They want their document to be used by two people, one of them will only be able to see say 4 pages of it while the other will be able to see it all including what the person before had entered.
    I think you can get around the text part quite easily but to have it show different parts of the form via a password is very hard for me to do (even if it is possible at all)
    Can anyone lend me a hand in this?
    If you need me information feel free to ask.

    It sure is possible. I have been doing it for quite some time now and this would be a perfect situation for the Action Builder if coding in FormCalc is not your thing, but I can give you both.. I will use a sample form for the demo so if the lingo doesn't match up to your form, let me know or if you need an example. If anyone has anything simpler or I missed something, let me know. PM me if you want a sample form.
    Create a new PDF and add in a second blank page and set that page to hidden in the Object field. Place a text field on page 1. Go to the Action Builder (in Windows go to the toolbar at the top, then "Tools" then select "Action Builder". The Action Builder is a great tool to add some extra functions into your PDFs with the preset actions. From the Action Tool box select the "Add New Item" from the top left of the box, right next to the trash can icon. This will create a new Action. There are 2 things for the Action: a condition and then a result. In the Condition section click the "object" link and then select the text field you put on page 1. Once you select the text field, the Condition box will change to "when text field TextField1...." and there will be 2 drop down boxes. With the condition set as "Is" put your password in the blank field. Then in the Result section select the drop down box and go to "Show/Hide an Object"and then select Page 2. What this will do is when TextField1 is equal to your password, page 2 will be visible. You can do this with not only a page, but specific elements within the PDF. So additional Textfields, pages, static text or other elements. One thing to keep in mind is what I like to call "foward/backwards logic" in that a user can enter the password to show the data, then remove it to hide whatever. Just go back through the Action Builder in reverse order that you did, where when TextField1 IS NOT the password, set the elements to hidden.
    If you can do this via Formcalc, the setup would be similar, but instead of using the Action Builder you could do something like, create a numericField that has a number based password. On that field, go to your Script Editor, select "Change: from the show section, change the Language to FormCalc and then enter:
    if ($.rawValue==1)then
    xfa.resolveNode("Page1).presence = "visible"
    else xfa.resolveNode("Page1").presence = "hidden"
    endif
    The bolded 1 is the password. The second and third lines cover what you want hidden or visible. So change whatever you want the password to, change the hidden and visible sections and then give it a try. You could even set this on a docReady show option as well to check that field when the form is opened if perhaps the first person saved the PDF with the hidden sections open. That way they do not need to enter the password every single time. Of course before they send it they should remove the password. Just be ready that whenever the user opens the form, even if they do not change anything, they will be prompted to save.

Maybe you are looking for

  • CSS Layout Questions

    Only making baby steps in CSS still but I am learning a lot. Here's a link to the page I am trying to create: http://www3.telus.net/~jessum/details_layout.html Here's what I have managed to create so far: http://www3.telus.net/~jessum/details.html Wh

  • Please Help...My photos are cut off in my slideshow

    Hello, I am making a slideshow using IMovie. I am using photos from IPhoto. When I drag them to the strip and then play my show, many of the photos are cut off. You can't see the whole photo. Example, my daughter is on a balance beam and you can only

  • FI SD - Tax link

    hai, In FI i have created own tax proceedure. (condition type,access sequence &account key) Like the way in SD they are maintaining pricing proceedure as per their own.  How do integrate these two? govind.

  • Use access level in BPEL console

    Hello Everyone, We started using BPEL (SOA Suite 10.1.3.3) for OTM to 11i integration. Currently, everyone has access to the BPEL console to monitor BPEL processes or to track errors, even in production. Now this is really scary as anyone could go in

  • Send to Color Error

    In the past this has worked but in the last week every time I try to export to Color I get the same edit which is not even loaded as a sequence. It is an early assembly of the same project but I have closed all other sequences and only have the seque