The next issue is how to deal with the precision. It almost looks like the XSL file is trying to get the precision from the LandXML dump, but the precision doesn't seem to be IN the LandXML dump. For example, for the precision of a parcel line distance, it uses the following:
string($Parcel.Line_Segment_Length.precision)
Where is it trying to get that from? Is it supposed to be in my LandXML somewhere, or is something else going on? If it's supposed to be in my LandXML, how do I get it there? I'm guessing I can just hard-code it to two decimal places, but I'm trying to understand what Autodesk did.
OK, more progress to report.
First off, there's actually a little bit of help on the subject (though not much). It's not in the Autocad or C3D help, though, but in the help for the XML Reporting 7 utility that is installed as a seperate program.
I was not able to get the structures like $Parcel.Line_Segment_Length.precision to work. It appears that they are defined in Parcel_Layout.xsl, but I'm not entirely sure how to get them working, or why they aren't working. Hell, I don't even know what language I'm programming in. I think it's JavaScript, but I really don't know...
Since I'm not sure which language this is or how it works, I'm not entirely sure how to fix the problem. So for the time being, I ended up just hacking some of them. This got things working for now, and then I can go back and figure more out later. The precision settings seem to be the ones I'm really having problems with, so I just changed things in my main XSL file to hard-code in the precision. I now have lines like the following:
OLD VERSION:
<xsl:value-of select="landUtils:FormatNumber(string($LineLength), string($SourceLinearUnit), string($Parcel.Line_Segment_Length.unit), string($Parcel.Line_Segment_Length.precision), string($Parcel.Line_Segment_Length.rounding))"/>
NEW VERSION:
<xsl:value-of select="landUtils:FormatNumber(string($LineLength), string($SourceLinearUnit), string($Parcel.Line_Segment_Length.unit), string('0.00'), string($Parcel.Line_Segment_Length.rounding))"/>
I've also discovered a lot of other issues. I started with the MetesBounds.XSL file from Autodesk. I already mentioned the problem I'm having with the precisions. The curve calls did not include a call for the arc length of the curve, something that is typically required in a metes and bounds description. In addition, the file did something truly BIZARRE with the curve deltas, returning a value that isn't even remotely correct. It was attempting to format the Delta angle using the Distance formatting commands, and returning GARBAGE. And from the date in the file, it's been like that since 2002... Guess not many people are using this stuff???
I also already mentioned that the Bearings were not being formatted the way I wanted them. Turns out the reason for this is that the formatting is hard-coded into the XSL file. It *should* be getting this data from the Civil-3D drawing, but it doesn't. And it also turns out that the bearing encoding routine exists in at least three different places in the XSL files. So in order to get all my bearings to print the way I want them, I had to edit the code in a lot of places, not just in the file I mentioned in my last post. A real fix would involve getting this information out of the Civil-3D drawing settings and styles, but that's more work than I'm interested in right now.
As usual, it was a lot more work getting this thing working than it should've been. But now I've got C3D directly dumping metes-and-bounds descriptions of my parcels out into text that I can simply copy and paste into an MTEXT block in my drawing. No more manual legals! I still have to go through and add in any calls to adjacent parcels, but C3D is dumping all the bearings and distance calls into a file for me, and that's the part where the errors usually appeared.
A programming background seems to be important, but the XML Reporting seems to be truly useful. I'm enclosing a PDF of the results I'm getting right now.
In order to create the attached PDF, all I had to do was create my parcels, then click "Execute" on my Metes and Bounds report. That's it. Very fast, and no third-party software. It just took several hours of digging through ancient, buggy Autodesk code...