Best way to handle optional elements in XSLT

Hi All,
I'v wondering if there are any better ways to handle optional fields in XSLT.
For example if my Person Type has 5 fields and 3 of them are optional:
<xs:complexType name="PersonType">
<xs:element name="PersonID" min="1"/>
<xs:element name="PIN" min="1"/>
<xs:element name="FirstName" min="0"/>
<xs:element name="MiddleName" min="0"/>
<xs:element name="LastName" min="0"/>
</xs:complexType>
In my xslt file, if I do somthing like:
<Person>
<FirstName>
<xsl:value-of select="PersonType/FirstName"/>
</FirstName>
</Person>
I might get an empty FirstName element in my output xml file. (like <FirstName/>) This has caused some very weired behavour with Oracle v2 parser because optional means the node may not be present in the xml not the node is there but empty.
The only way I can think of solving this is to put <xsl:if test> around every single optional element to test if it exist in the source file. If it does then generate the element in the destination file. But in this way, if the source file is very complicated, then you would have to wrap each element with a <xsl:test> which is very ugly to me.
Do anyone know if there is a more generic way that we can solve this issue?
Thanks,
Larry

Dharmendra,
The answer you gave is very very helpful. The only thing that I can think of here is that it might accidentally delete the fields that have been set empty deliberately.
Maybe, this is one of the grey areas in XML Schema that I do not understand very well yet. In xml, if you define an element to be a string type and mandatory (minOccurs="1"), for exampe the following xml
<Name></Name>
will be valid against the schema because the Name element is present in the xml payload. However, it has no value or has a valud of empty string. I know that this is only a problem with string type. If it is boolean, then it has to be either true of false, being empty won't satisfy the schema validator. But with String it is a bit trickier, because String can be empty. Maybe this issue should be stopped when designing your xml schema by specifying the mininum length (>0) in the schema. Any suggestions would be welcomed.
Cheers,
Larry

Similar Messages

  • (workflow question) - What is the best way to handle audio in a large Premiere project?

    Hey all,
    This might probably be suitable for any version of Premiere, but just in case, I use CS4 (Master Collection)
    I am wrestling in my brain about the best way to handle audio in my project to cut down on the time I am working on it.
    This project I just finished was a 10 minute video for a customer shot on miniDV (HVX-200) cut down from 3 hours of tape.
    I edited my whole project down to what looked good, and then I decided I needed to clean up all the Audio using Soundbooth, So I had to go in clip by clip, using the Edit in SoundBooth --> Render and Replace method on every clip. I couldn't find a way to batch edit any audio in Soundbooth.
    For every clip, I performed similar actions---
    1) both tracks of audio were recorded with 2 different microphones (2 mono tracks), so I needed only audio from 1 track - I used SB to cut and paste the good track over the other track.
    2) amplified the audio
    3) cleaned up the background noise with the noise filter
    I am sure there has to be a better workflow option than what I just did (going clip by clip), Can someone give me some advice on how best to handle audio in a situation like this?
    Should I have just rendered out new audio for the whole tape I was using, and then edit from that?
    Should I have rendered out the audio after I edited the clips into one long track and performed the actions I needed on it? or something entirely different? It was a very slow, tedious process.
    Thanks,
    Aza

    Hi, Aza.
    Given that my background is audio and I'm just coming into the brave new world of visual bits and bytes, I would second Hunt's recommendation regarding exporting the entire video's audio as one wav file, working on it, and then reimporting. I do this as one of the last stages, when I know I have the editing done, with an ear towards consistency from beginning to end.
    One of the benefits of this approach is that you can manage all audio in the same context. For example, if you want to normalize, compress or limit your audio, doing it a clip at a time will make it difficult for you to match levels consistently or find a compression setting that works smoothly across the board. It's likely that there will instead be subtle or obvious differences between each clip you worked on.
    When all your audio is in one file you can, for instance, look at the entire wave form, see that limiting to -6 db would trim off most of the unnecessary peaks, triim it down, and then normalize it all. You may still have to do some tweaking here and there, but it gets you much farther down the road, much more easily.Same goes for reverb, EQ or other effects where you want the same feel throughout the entire video.
    Hope this helps,
    Chris

  • Best way to handle text files in OD10g

    We have a requirement to store reports in text format into a database field, to be able to view the reports, and to print them if desired using Forms 10g. What is the best way to handle this?
    - define the field in the database as clob or blob?
    - if CLOB is the choice, what tools to use to upload CLOBs to the database (since webutil transfer is for blob only)?
    - in Forms 10g, can one use the Forms data type LONG for CLOB?
    - can you do Forms search on clob and blob fields?
    - how can reports that are stored in fields be viewed without first downloading to the client workstation?
    - in Forms 10g, what is the best way to view text files residing in local PCs: "host notepad myFile"?
    Thanks much for your reply!
    gk

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to handle multiple currencies

    I have a requirement that users should be able to report against an OLAP cube in a currency of their choice (from a list of about 20) and was wondering what the best way to handle this might be.
    One option would be to have a currency dimension containing the list of valid currencies and then to pre-calculate measures in each of the currencies and store them in the cube. However the downside of this is that the resultant cube would be 20 times larger than a cube in a single currency, take longer to maintain etc. I could of course partition the cube by currency to improve reporting performance since users would only report in one currency at a time.
    Another alternative would be to dynamically calculate the measures based on exchange rates - I guess this could either be done in the cube itself or as part of the reporting code. However since exchange rates are daily, this would obvioulsy prevent me from aggregating data up the time dimension (all measures are at the day level).
    Is there any standard way of doing this and what are the pro's and con's?
    Thanks,
    Chris

    Sorry - messed up - I should have posted this in the OLAP forum.....

  • Best way to handle large files in FCE HD and iDVD.

    Hi everyone,
    I have just finished working on a holiday movie that my octagenarian parents took. They presented me with about 100 minutes of raw footage that I have managed to edit down to 64 minutes. They have viewed the final version that I recorded back to tape for them. They now want to know if I can put it onto a DVD for them as well. Problem is the FCE HD file is 13Gb.
    So here is my question.
    What is the best way to handle this problem?
    I have spoken to a friend of mine who is a professional editor. She said reduce the movie duration down to about 15mins because it's probably too long and boring. (rather hurtful really) Anyway that is out of the question as far as my oldies are concerned.
    I have seen info on Toast 8 that mentions a "Fit to DVD" process that purports to "squash" 9Gb of movie to a 4.7Gb disk. I can't find if it will also put 13Gb onto a dual layer 8.5Gb disk.
    Do I have to split the movie into two parts and make two dual layer DVD's? If so I have to ask - How come "Titanic", 3hrs+ fits on one disk??
    Have I asked too many questions?

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to handle source files

    Hi there,
    After some pretty general advise please.
    The company I work for looks after a lot of websites, and one
    of the
    headaches we have is the best way to handle source files. By
    source files I'm
    referring to Photoshop files, Flash .fla files and also other
    none Adobe
    files that relate to a site, not the .html, .asp, .aspx,
    .css, .js etc type
    files.
    Now I'm NOT after a version control system, just a simple way
    to store the
    source files in a location that is separate from the website
    but still to be
    able to have a smooth workflow between the Dreamweaver site
    and it's source
    files.
    At the moment, and I know this is unwise, we have a
    subdirectory within the
    site where we store the source files, and use WebDAV to
    transfer both site
    and source files to and from the server. But I really want to
    separate the
    site from source but still maintain a link between site and
    source...... if
    you see what I mean. I think the upshot is I would like to be
    able to open a
    site within Dreamweaver and instantly be able to access that
    sites source
    files if needed. This method needs to be shared across a
    small team spread
    round the UK.
    I looked at the Repository Subversion version control, but
    like I said I'm
    not after a source control system, plus it appeared to
    conflict with WebDAV
    and Contribute, that some of our clients use to maintain
    content on their
    sites. I also looked at Version Cue which looked promising,
    but can't see a
    clear workflow between Dreamweaver and Version Cue which
    separates site from
    source. I might be missing something.... part of my brain
    perhaps. :)
    Would be grateful for any advice please.
    Cheers,
    @ndyB

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • Best way to handle session timeout

    Hello All,
    oracle 11g, Apex ver 3.1.2
    I am bit confused about the sessoin handling mecahnism for the users .
    Which is the best way to handle session for the users is it programatically or by DBA admin level.
    What are the pros and cons going DBA Level and Programmatica level.
    Before hand I got to have some information on hand for justification.
    thanks/kumar

    Hi,
    I've done a great deal of work with mobile accounts in Snow Leopard and I'm now having a "play" with Lion. To be honest you have to sit down and think about why you need mobile accounts.
    If your user only uses one computer then your safer having a local account backed up by a network Time Machine, this avoids the many many woes that the Servers FileSyncAgent brings to the table.
    If your users are going to be accessing multiple computers on the network and leaving the network then a mobile account is good for providing a uniform user experience and access to files etc. However, your users will have to make a choice as to whether they want their iPhoto libraries on one Local machine (backed up by Time Machine) or whether they want their library to be hosted on the server and not part of the Mobile Home Sync schedule (adding ~/Pictures to the excluded items on the home sync settings).
    With the latter, users will be able to access their iPhoto libraries on any computer when they are within the network (as it's accessed from the users server home folder).
    With the first option the user would have their iPhoto library on one computer (say the laptop they used the most) but then would not be able to access it from other computers they log on to.
    iPhoto libraries are a pain, and I'm working hard to come up with a workaround. If your users moved over to using Apeture then you could include the aperture library as part of the home sync thanks to Deeport (http://deepport.net/archives/os-x-portable-home-directories-and-syncing-flaw-wit h-bundles/)
    He does suggest that the same would work with IPhoto libraries - but it doesn't for a number of mysterious reasons regarding how the OS recognizes thie iPhoto bundle (it does so differently compared to Apeture).
    Hope this helps...

  • Best way to handle multi-page documents?

    Hi,
    I'm creating a multi-page editor on top of TLF and I'd like to hear some opinions about the best way to handle multi-pade documents.
    I'm basicaly considering two options:
    1.) A single RichEditableText and several ContainerControllers.
    2.) Several RichEditableText.
    Tks.

    I'm not sure you can create a RichEditableText and give it multiple ContainerControllers. If you use multiple RichEditableText
    components, then you will have to decide in advance which text goes in which one.
    We have posted sample code for doing this in straight ActionScript, which you could presumably also host inside a Flex container. See:
    http://blogs.adobe.com/tlf/examples/
    Look for "ActionScript Pagination Example".
    - robin

  • Best way to handle tcMultipleMatchFoundException

    Can any one tell me what is the best way to handle tcMultipleMatchFoundException during Reconciliaiton.
    One way which i know is to manually correct the data. Apart form is there any way..?
    Thanks,
    Venkatesh.

    Hi,
    I've done a great deal of work with mobile accounts in Snow Leopard and I'm now having a "play" with Lion. To be honest you have to sit down and think about why you need mobile accounts.
    If your user only uses one computer then your safer having a local account backed up by a network Time Machine, this avoids the many many woes that the Servers FileSyncAgent brings to the table.
    If your users are going to be accessing multiple computers on the network and leaving the network then a mobile account is good for providing a uniform user experience and access to files etc. However, your users will have to make a choice as to whether they want their iPhoto libraries on one Local machine (backed up by Time Machine) or whether they want their library to be hosted on the server and not part of the Mobile Home Sync schedule (adding ~/Pictures to the excluded items on the home sync settings).
    With the latter, users will be able to access their iPhoto libraries on any computer when they are within the network (as it's accessed from the users server home folder).
    With the first option the user would have their iPhoto library on one computer (say the laptop they used the most) but then would not be able to access it from other computers they log on to.
    iPhoto libraries are a pain, and I'm working hard to come up with a workaround. If your users moved over to using Apeture then you could include the aperture library as part of the home sync thanks to Deeport (http://deepport.net/archives/os-x-portable-home-directories-and-syncing-flaw-wit h-bundles/)
    He does suggest that the same would work with IPhoto libraries - but it doesn't for a number of mysterious reasons regarding how the OS recognizes thie iPhoto bundle (it does so differently compared to Apeture).
    Hope this helps...

  • Best way to handle audio and video?

    Can someone give me suggestions on best way to handle audio and video clips. 2 issues:
    Audio- I want to avoid problems for visitors who may need to install something to listen, and would like them to be able to remain viewing page while listening. I understand how to set up the Iweb player option, and I understand how to simply link to a mp3 file that relies on the visitors player. I'm thinking I need to "embed a player" (?) which is something I haven't dealt with yet.
    Video- I have a link to a .mov file. It plays it in either a real small box, or if you enlarge it , the image deteriorates. Is there a better way to handle this?
    http://www.imaginerecoveryonline.com/IMAGINERECOVERYONLINE.COM/THE_JOURNEY_1.htm l
    Thanks for any help

    Yes that should work for what you want.

  • Best way to handle mobile accounts with large itunes/photo libraries

    What is the best way to handle mobile accounts, but not syncing itunes/photos libraries?
    I have a time capsule so I can move itunes and photos libraries for each user if need be.
    Thanks!

    Hi,
    I've done a great deal of work with mobile accounts in Snow Leopard and I'm now having a "play" with Lion. To be honest you have to sit down and think about why you need mobile accounts.
    If your user only uses one computer then your safer having a local account backed up by a network Time Machine, this avoids the many many woes that the Servers FileSyncAgent brings to the table.
    If your users are going to be accessing multiple computers on the network and leaving the network then a mobile account is good for providing a uniform user experience and access to files etc. However, your users will have to make a choice as to whether they want their iPhoto libraries on one Local machine (backed up by Time Machine) or whether they want their library to be hosted on the server and not part of the Mobile Home Sync schedule (adding ~/Pictures to the excluded items on the home sync settings).
    With the latter, users will be able to access their iPhoto libraries on any computer when they are within the network (as it's accessed from the users server home folder).
    With the first option the user would have their iPhoto library on one computer (say the laptop they used the most) but then would not be able to access it from other computers they log on to.
    iPhoto libraries are a pain, and I'm working hard to come up with a workaround. If your users moved over to using Apeture then you could include the aperture library as part of the home sync thanks to Deeport (http://deepport.net/archives/os-x-portable-home-directories-and-syncing-flaw-wit h-bundles/)
    He does suggest that the same would work with IPhoto libraries - but it doesn't for a number of mysterious reasons regarding how the OS recognizes thie iPhoto bundle (it does so differently compared to Apeture).
    Hope this helps...

  • What's the best way to handle new versions of software?

    So we have an Application setup for Adobe Reader (just using Reader as a general example) which is part of our Task Sequence.  When Adobe releases a new version of Reader, what's the best way to handle getting the new version into our SCCM setup.
    I know I can create a new application and do it all over and select the new file, but can I simply replace the files that the application is pointing to and then somehow tell it to update the DPs with the new files?  I'd rather not have to create new
    applications every time if I don't have to.
    Thanks.

    I think continue the way you are doing right now by creating a new application each time there is a version change. Its a clean way to do and this helps with Application life cycle mgmt aswell where you keep track of versions across the environments and
    eventually retire an application. Specially where no changes are made without a change control. This is completely process specific and may not be applicable.
    i do agree with above posted comments about using supercedence option.
    However most of the apps comes with upgrade capabilities from previous versions. So you can upgrade existing version with new one if you do not wish to use supercedence. 
    Thanks 

  • Best way of handling large amounts of data movement

    Hi
    I like to know what is the best way to handle data in the following scenario
    1. We have to create Medical and Rx claims Tables for 36 months of data about 150 million records each - First month (month 1, 2, 3, 4, .......34, 35, 36)
    2. We have to add the DELTA of month two to the 36 month baseline. But the application requirement is ONLY 36 months, even though the current size is 37 months.
    3 Similarly in the 3rd month we will have 38 months, 4th month will have 39 months.
    4. At the end of 4th month - how can I delete the First three months of data from Claim files without affecting the performance which is a 24X7 Online system.
    5. Is there a way to create Partitions of 3 months each and that can be deleted - Delete Partition number 1, If this is possible, then what kind of maintenance activity needs to be done after deleting partition.
    6. Is there any better way of doing the above scenario. What other options do I have.
    7 My goal is to eliminate the initial months data from system as the requirement is ONLY 36 months data.
    Thanks in advance for your suggestion
    sekhar

    Hi,
    You should use table partitioning to keep your data on monthly partitions. Serach on table partitioning for detailed examples.
    Regards

  • What is the best way to handle input parameter

    When writing sub-vi's, what is the best way to handle input parameter range checking? On the front panel I can choose to have numeric values coerced to be within range, but this does not affect constants or controls wired to the vi when used as a sub-vi. I can build range checking into the vi, but this can result in a cluttered looking vi. Do you have any suggestions.

    As you discovered, the Range and Coercion properties of controls do not work when used in sub-vis.
    Your best option is to go ahead and build your range checking into your sub-vis. If it�s something you will be doing a lot, just make your range checking a sub-vi and drop it where needed. This will keep the clutter to a minimum. You may end up with more than one range checking VI if you need different functionality, but this will still make less clutter and easier re-use.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Best way to handle all erros and get performance(OCI)?

    Hi there,
    Im using[b] Oracle Call Interface to execute batch file process. But I have got a problem.
    I set ExecuteBatch with the same number of commit time, i.e: 100, 1000 or just 10, for thats ok.
    ((OraclePreparedStatement)globalStmt).setExecuteBatch(commit);
    And I handle executeUpdate to catch all SQL Exceptions. I made some proposital files with invalid erros but when I handle "executeUpdate" it�s doesn�t get the corrent error line, and puts out another line that is corret.
    ((OraclePreparedStatement)globalStmt).executeUpdate();
    Check in the code I concluded that its always get the same sequence of commit number like the error line. For example, I have between line 1 - 50 a line error, this line is 31, but I set the commit time for 50, its show me that line errror is 50 wherever 31. But if I put setExecuteBatch with '1' so it can handle corret lines erros, but the system performance bring down. What is the best way to handle all erros and keep the perfronace?
    Sorry for my english, I am not native. Thanks all.

    So by doing this, everything will transfer and look exactly the way I have it on the old machine?
    That is correct, if your old machine is Intel based after using MA the new machine will look just like the old machine. Here is information from Apple on MA, I'd recommend looking it over.
    My recommendation is to answer NO when setting up the new machine when it asks "Are you moving from another Mac?" The reason being let you new machine get set up and run for a couple of hours to ensure it's fine. Then launch MA and follow the prompts, it's very easy and if you use a fast connection like FW it should go smoothly.
    Regards,
    Roger

Maybe you are looking for